Install: Linux launcher hangs checking .nup and exhausts system memory #1525
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot#1525
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Reported on Discord
What happened?
On Linux Bazzite, Longshot Launcher nightly-137-7012f7f4 remained on “Checking...” for the
.nupgame file and did not finish. After about a minute, memory use became critical and the system ran out of memory. The reporter suspects the game file may be corrupted, but this has not been confirmed. The screenshot shows 59.1 GiB of 60.4 GiB memory and 4.3 GiB of 16.0 GiB swap in use.Steps to reproduce
The reporter downloaded the nightly launcher, opened it, and selected
The Legend of Zelda Ocarina of Time.nupin~/Documents. The check remained stuck until system memory was nearly exhausted. The reporter took the memory screenshot before it became critical.Expected behavior
The game-file check should complete or report an error without exhausting system memory.
Environment
Logs and screenshots
Launcher log:
Copy the attached launcher log and screenshots showing the
.nupstuck at “Checking...”, launcher version, and memory/swap usage. The log contains no indication of the check itself; it ends with a normal launcher close.Files from the Discord report:
Root cause measured on the launcher side (no game data attached):
make_game.py --check, which runs Longshot'snx2/nup.py, andNup.__init__(nx2/nup.py:143-159) trusts the table of contents' u64 counts and offsets before validating them:meta = f.read(0x80 + strings offset + strings size)reads up to the whole file,self.strings = meta[...]slices a second near-full copy, and then the titles/dirs/files/child lists are built per entry.CheckAsynckept every stdout line the check wrote, and the check's process tree had no memory cap.The launcher-side mitigation is in progress on
fix/nup-toc-memory(base6887d57c): a 176-byte header preflight that refuses a TOC that cannot fit the file or is far larger than a game dump's before any tool starts, a hardRLIMIT_ASinherited bymake_game.pyandnx2/nup.pyon Linux, and a bounded output ring. No PR yet; nothing built or run yet.@dyst owns the
nx2/nup.pyfix, and I am not touching it: this is only the launcher's side.Launcher side, now with tests and a run — no game launch, no game data attached. PR:
MagicBeanDev/LongshotLauncher#252
Before/after, same read.
nx2/nup.py:143-159readsmeta = f.read(0x80 + strings offset + strings size)(up to thewhole file) and then copies the names again with
self.strings = meta[...], before any count is checked:nx2/nup.py)Core/NupIndex.cs)MemoryErroratnx2/nup.py:143underulimit -v 2 GiB, OOM-killed underMemoryMax=2GSo the measured multiplier is 2.32× on a file of the same shape: at 25.6 GB that is the 59.1 GiB in the screenshot
(the sparse file is a header and a hole — no game data, and it never leaves this PC).
Fix — two commits on
fix/nup-toc-memory, base6887d57c:32b848fe—Core/NupIndex.csreads 0xB0 = 176 bytes before any tool starts and refuses a TOC that cannot fit thefile or is far larger than a game dump's (256 MiB TOC, 64 MiB names, 2.5 M files), saying "damaged" or "incomplete";
MakeGameRun.Boundedruns the check under an inheritedRLIMIT_AS(half the PC's memory, 1–2 GiB) through bashulimit -v, somake_game.pyand thenx2/nup.pyit starts cannot grow past it;CheckAsynckeeps the check's last512 lines, not every line.
b372d00— a fix the suite caught: with bash in front of the check, a missing tool no longer madeProcess.Startfail, so a run said "stopped without saying why (127)" and blamed the file. A program that is not there is now left
unwrapped, so the answer is this PC's again —
tests/launcher_core's "Tools that do not start: this PC's, not thefile's" is what caught it, and a new check holds the rule.
Tests (built from
Core/atb372d00):tests/launcher_core— 2704 checks passed, 0 warnings, 0 errors, including the newNupIndexChecks(sound dumpaccepted from 176 bytes; a 1 TiB header with names past its TOC refused from 176 bytes; every count/offset bound
refused; the wizard reading
NupIndex.Whybefore it starts the tools).tests/test_release.py— 42 tests, OK.python -I tests/test_launcher_core.pystill stops at its translation gate: 48 "left over" texts, the same 48 with thesame texts on
main(6887d57), which is what @dyst's open #246 fixes. This branch changes no catalog text; it is redon
mainand here alike.The
nx2/nup.pyfix itself is @dyst's and is untouched: this is only what the launcher can do — never start the tools on aheader it can prove is wrong, and cap what the tools can take.