fix(queue): a job's free-memory floor follows its mode and the PC #2257
No reviewers
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
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2257
Loading…
Reference in a new issue
No description provided.
Delete branch "dazemc/Longshot:fix/queue-light-beside-timing"
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?
This PR is now only the mode/capacity-aware memory floor. (a) "a light job and a timed run take turns" is superseded by #2403 (
caf690e6), and (b) "a light job and a game take turns" conflicts with #2403's contract — its test asserts a light job may start beside a GPU run (assertIsNone) — so both are dropped. #2409 (90fae88c) is the other upstream change on the same paths.Summary
memory_short()waited for the flatLONGSHOT_QUEUE_MIN_FREE_GB(6 GB) whatever the job was, so a light check waited for the memory a game needs and an 8 GiB PC could run nothing.The floor is now
base + FREE_GB[mode], capped atmax(2.0, total * 0.4):LONGSHOT_QUEUE_MIN_FREE_GB, 2 GB by default (the flat 6 is gone);FREE_GB: 0 light, 2 build, 4timing-cpu, 8shared/gpu/timing/profile;FREE_SHARE = 0.4, so no PC reserves more than 40% of its RAM.FREE_GB[mode]lightbuildtiming-cpushared,gpu,timing,profile0still disables the memory gate, as before.Testing
Tested: the focused test at this head —
python -I -B tests/test_job_queue.py: 33 tests, 6 skipped, OK. It covers an 8 GiB PC with 2.5 GiB free starting a light check, and the per-mode floor on 8, 15.5 and 32 GiB PCs.Suite: a light suite ran at this head —
mise run test -- --jobs 5, in thesuite-2257-448c312f.scopewithMemoryMax=12G— 941 passed, 20 failed, 18 skipped in 406 s (linux, 5 at once), exit 1. Logprrefresh-logs/suite-2257-448c312f.log, sha25690ddf528c12d53c84de0becf7680a9ec557af124ed69e7f1a636871a88d503ef(matchesprrefresh-logs/suite-2257-448c312f.compare.txt, header961 checks, 18 skipped, 5 at once (linux)). Compared withmain8aa5ab87: the 19 CORE ids fail identically, plustests/test_crash_record.py(FLAKY:TimeoutExpiredattest_crash_record.py:363, which passes when run alone on both heads); no id outside CORE ∪ FLAKY, and the same 18 skips. The 20==== FAILblocks agree with the 20 failure rows, and the JUnit (979tests,20failures,18skipped) reconciles with the summary. The run ends with[test] ERROR task failed: that is the runner echoing the task's non-zero exit, not a test failure — the baseline logs end the same way. Not the game: the change is the queue's memory floor, not the game.Still to test: None — the focused check and the 5-job suite at this head cover the change.
Still to test
mise run test -- --jobs 5), expecting the same result asmainat that time. — Answered: suite at448c312f, 941 passed / 20 failed / 18 skipped in 406 s (linux, 5 at once), exit 1, logprrefresh-logs/suite-2257-448c312f.logsha25690ddf528c12d53c84de0becf7680a9ec557af124ed69e7f1a636871a88d503ef.Measurements
No performance number: the change decides when a job waits for memory, not how fast it runs. The evidence is the focused test above.
Risks
0disables the memory gate, as before, for tests and an operator who knows the PC.Read first:
scripts/devtools/jobqueue.pymemory_short(),FREE_GB,FREE_SHAREandDEFAULTS;tests/test_job_queue.pyRules;docs/dev/developing.md"Share a PC: the job queue".Prior work: #2177 sizes
run_all's default--jobsby memory, which a caller passing--jobs 5bypasses.Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses: every failing id is CORE or FLAKY, none outside the union. Suite at448c312f21f9e856cf6a8c0994993217043e20ed: 941 passed, 20 failed, 18 skipped in 406 s (linux, 5 at once), logprrefresh-logs/suite-2257-448c312f.log, sha25690ddf528c12d53c84de0becf7680a9ec557af124ed69e7f1a636871a88d503ef. Failures: the 19 CORE ids, plustests/test_crash_record.py(FLAKY,TimeoutExpiredattest_crash_record.py:363; passes when run alone on both heads); no id outside CORE ∪ FLAKY. The run ended with[test] ERROR task failed— the runner echoing the task's non-zero exit (the baseline logs end the same way), not a test failure. Witness:prrefresh-logs/suite-2257-448c312f.compare.txt(head=448c312f…) matches this PR's head, with.start/.end/.exitpresent and the JUnit (979/20/18) reconciling; no.headexists for pre-ticket logs.Two earlier runs at this head were void (missing header env; then overlapping another suite) and are recorded in the round log, not used here.
main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here.tests/that reads changed source is updated, not weakened.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.Focused test from the PC after the freeze (the queue is on hold):
af1d2951(main code plus these tests),python -I -B tests/test_job_queue.pyfails 4:Rules.test_slots: a light job starts beside a GPU job.Rules.test_a_job_waits_for_ten_gb_free: 8 GiB free passes the 6 GiB floor.LightBeside.test_light_waits_for_a_timed_run_or_a_game: no conflict beside timing, timing-cpu, gpu, shared or profile.LightBeside.test_a_timed_run_or_a_game_waits_for_a_light_suite: the same in the other start order.fe96ffbf:python -I -B tests/test_job_queue.py-> 28 tests, 5 Windows-only skips, OK.python -m py_compileon both changed Python files OK.python -I scripts/check_pr_description.py --file ...reports only the untickedmise run testbox; the PR stays WIP until the full suite runs.@review
Recommendation: Request changes. The new memory floor can indefinitely block every queued job on smaller Linux machines, and older checkouts can still start the conflicting jobs this change is meant to separate.
The change serializes light jobs with game and timing jobs when both use the new queue, and raises the default memory threshold. It prevents the tested conflict in that case but can stop otherwise usable workflows and does not protect mixed-version queues.
Blocking (2): must change before merging.
scripts/devtools/jobqueue.py:80: The fixed 10 GiB floor can make the queue unusable even for small jobs. (more on the line) Do: Choose a default that permits supported smaller machines to make progress, with an appropriate mode-specific or capacity-aware policy, and test the below-10-GiB case.scripts/devtools/jobqueue.py:453: The new exclusion is enforced only by the version starting the second job, while the queue is explicitly shared by different checkouts. (more on the line) Do: Make the protocol protect the exclusion when an older queue starts second, or require and enforce migration to a compatible queue before accepting jobs; add a mixed-version test covering both start orders.Nits (1): optional.
docs/dev/developing.md:168: The shared-mode row says it never runs beside a timed run, but timing-cpu explicitly permits it. (more on the line) Do: Distinguish GPU timing and profile jobs from timing-cpu in the shared-mode row.@fixcan do L1, L2 and L3.Checks: Still running: 10 checks.
More: does it help, other systems, switches, what was read
Does it help: Yes for the in-memory scheduling cases: the author reports four tests failing on the base and passing with this change. A real suite beside an AB run has not been tested, and the protection does not cover an older queue starting second.
Other systems: The queue is shared across checkouts and runs on Linux and Windows. Linux machines with under 10 GiB available can wait indefinitely; Windows does not read the Linux memory information used by the floor. The change does not alter the game or renderer.
Switches: LONGSHOT_QUEUE_MIN_FREE_GB changes from 6 to 10 GiB by default. That default can prevent all queued jobs from starting on smaller Linux PCs and has no effect on Windows; environment and configuration overrides remain available.
Reviewed:
fe96ffbf1eagainsta2dc538590: Read AGENTS.md, CONTRIBUTING.md, the PR template, standards, the complete diff and commit messages, and the changed Python files and relevant queue documentation. Skimmed the rest of developing.md and queue callers. docs/review-checklist.md and the sibling Tooling checkout were absent. No generated files or recorded runs were changed.; nothing run (a code review).Checked and fine:
Testing: Read-only review; no commands from the project or tests were run. The author reports 28 focused tests passing on Linux, with five Windows-only skips; the full suite and real AB/suite run remain outstanding.
Overlaps and merge order: The description identifies #2187 and #2177 as related work; their diffs were not available for review.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
@ -170,2 +167,2 @@| `timing` | fps, frame times, hitches | Nothing heavy; own CPUs; memory not swapped; not while you play || `timing-cpu` | A measured build | GPU runs on the other CPUs || `light` | Game-free checks, renderer-only builds, copies | 4 at once; never a timed run or a GPU job || `shared` | A game run that is not a number: screenshots, logs, checks | 3 at once, each with its own game and data folder; never a timed run or a light job |L3 (nit): The shared-mode row says it never runs beside a timed run, but timing-cpu explicitly permits it.
When: A shared game may start beside a timing-cpu job because the latter has no GPU claim and the conflict rules allow the pair, contrary to this row.
Do: Distinguish GPU timing and profile jobs from timing-cpu in the shared-mode row.
@ -76,1 +78,3 @@"LONGSHOT_QUEUE_MIN_FREE_GB": "6",# (10 GiB free, not 6: an AB game run peaks at 8-12 GiB on a 15 GiB PC, and the 2026-11-22 suite started at 6 and# left the host out of memory before the run finished)"LONGSHOT_QUEUE_MIN_FREE_GB": "10",L1 (blocking): The fixed 10 GiB floor can make the queue unusable even for small jobs.
When: On a Linux PC with 8 GiB RAM, MemAvailable can never reach 10 GiB. Every mode, including a light copy or renderer build, repeatedly fails memory_short() and waits forever; the previous 6 GiB floor could permit it to start.
Do: Choose a default that permits supported smaller machines to make progress, with an appropriate mode-specific or capacity-aware policy, and test the below-10-GiB case.
@ -445,0 +450,4 @@# started first; on 2026-11-22 a light suite started beside a timing AB run on a 15 GiB PC, the game's 9-12 GB peak# left the NVIDIA driver unable to allocate host memory, and the PC froze)if use.light and (t.get("gpu") in ("exclusive", "shared") or t.get("cpu") == "quiet"):return "a light job: " + names(use.light)L2 (blocking): The new exclusion is enforced only by the version starting the second job, while the queue is explicitly shared by different checkouts.
When: A light suite started from this checkout is active when a timing job from a base checkout enters its old conflict() implementation. That implementation does not consider active light tickets, so it starts the timing job beside the suite and can reproduce the reported memory exhaustion.
Do: Make the protocol protect the exclusion when an older queue starts second, or require and enforce migration to a compatible queue before accepting jobs; add a mixed-version test covering both start orders.
fe96ffbf1eab56489c86Review round: rebased onto
753fb5afand force-pushedab56489c(wasfe96ffbf). No code change since the focused test run; the PR stays WIP.timing-cpu, 8 GB game/timing, capped at 40% of RAM. The tests cover an 8 GiB PC's light job starting, and the 8 / 15.5 / 32 GiB game floors.protocol=2;queue statusnames an older runner. The docs say finish/cancel it and update every checkout; old runners can still overlap by design, anddev.py migratecannot change a running one.shared/gpunow say "never an exclusive timed run (timing/profile)", becausetiming-cpumay run beside them.abrunin a queue job; use queue-light +systemd-run --user --scope -p MemoryMax=12G -- <cmd>, orabrundirectly when the queue is idle.Tests: test-only
f2a61b69fails 5 on main;ab56489cpasses 30, 5 Windows-only skips;py_compileOK. The fullmise run testis still unticked and the PR remains WIP: the box was not clean (AB B1 game ~10 GB, MemAvailable 1.6 GB, swap 1.9 GB). No game or heavy suite was run.Clean suite baseline comparison — settles the
mise run testbox.Same rule on both runs:
queue-light+systemd-run --user --scope -p MemoryMax=12G -p MemorySwapMax=0 -- mise run test -- --jobs 5; headers env; no abrun.753fb5afab56489c2257-main-baseline, ticket PID 523192, ran 417.1 s2257-suite, ticket PID 474424, ran 405.5 srun-p523215-i478406.scoperun-p474426-i412365.scopeThe same five checks fail for the same reasons in both runs:
tests/test_mise_build.py(2 assertions) — actual args gain--work /dev home/workbefore the given args.tests/test_pipeline_state_computes.py— “a compute plan is made from something other than precompile_computes_which”.tests/test_saveload_warm_cache.py— fixture compile fails-Werror,-Wunused-but-set-globalon the same three stub vars.tests/test_dev_packs.py— “a game patch shows in the objects”.tests/test_cpm_discovery.py—'/usr/local' is not None.Caveat: the main baseline ran alongside
2247-suitelight with 15 GB disk free. It had no timeouts;test_nup_verifypassed on both. The identical failure set and reasons mean the caveat does not change the classification of these five.No #2257-specific failure; no new failure attributable to this PR. Local evidence:
/home/daze/.local/share/longshot-dev/suite-evidence/2257-main-baseline-753fb5af.log— sha256795f024dcf31803fdc4dc0b9a5d1460e6bec3d58426c5cff38639f6076e6dd51/home/daze/.local/share/longshot-dev/suite-evidence/2257-suite-ab56489c.log— sha2567494880ae8d3f419fa454a880159deada70fc604a3daae10261df26b6f3e38ee/home/daze/.local/share/longshot-dev/suite-evidence/2257-suite-baseline-comparison.txt.../queue/tmp/2257-main-baseline-523192,.../queue/tmp/2257-suite-474424WIP: fix(queue): a light suite waits for a timed run or gameto fix(queue): a light suite waits for a timed run or gameClean-suite same-reason evidence (numbers only).
Result lines
753fb5af(log line 2007):934 passed, 5 failed, 18 skipped in 416 s (linux, 5 at once)— queue2257-main-baseline, ticket 523192, history ran 417.1 s, status 1.ab56489c(log line 2027):934 passed, 5 failed, 18 skipped in 405 s (linux, 5 at once)— queue2257-suite, ticket 474424, history ran 405.5 s, status 1.753fb5afab56489ctests/test_cpm_discovery.pyAssertionError: '/usr/local' is not NoneAssertionError: '/usr/local' is not Nonetests/test_dev_packs.pyFAIL: a game patch shows in the objectsFAIL: a game patch shows in the objectstests/test_mise_build.py(2 assertions)AssertionError: Lists differ: ['--work', '/dev home/work', '--nup', 'Game [[95 chars]ork'] != ['--nup', 'Game [v131072] with spaces.nup', '[67 chars]ork']tests/test_pipeline_state_computes.pya compute plan is made from something other than precompile_computes_whichtests/test_saveload_warm_cache.pyerror: variable 'stub_build_probe_ask_start_first' set but not used [-Werror,-Wunused-but-set-global]Caveat: both runs used
--jobs 5under the 12 GB/no-swap scope. The baseline overlapped the earlier 2247 suite and took 416 s vs 405 s, so timing is not compared. There were no timeouts;test_nup_verifypassed on both. The five failure texts are identical (except the fixture temp path), so all five are pre-existing on main753fb5af, not #2257-specific.Evidence logs:
/home/daze/.local/share/longshot-dev/suite-evidence/2257-main-baseline-753fb5af.log(sha256795f024dcf31803fdc4dc0b9a5d1460e6bec3d58426c5cff38639f6076e6dd51) and/home/daze/.local/share/longshot-dev/suite-evidence/2257-suite-ab56489c.log(sha2567494880ae8d3f419fa454a880159deada70fc604a3daae10261df26b6f3e38ee).L2 follow-up pushed as
3fe1f43a(test) andcd011547(fix), a fast-forward fromab56489c.What changed: a light ticket now carries the claim an older runner's
conflict()reads —gpu=exclusive,cpu=heavy— pluskind: "light"andprotocol=3. This version readskindand keeps the light rules and the 2 GB base floor, so a second light job and a build still run beside it; an older runner starting a timed run or a game second sees the claim and waits. An older runner over-serializes the suite (a build may count it), which is the safe direction: it cannot start the timing/game run beside it. A checkout belowprotocol=3writes no claim;queue statusnames it, and the docs say finish or update it.Tests: the test-only
3fe1f43afails onab56489catMixedVersions.test_an_older_runner_waits_for_a_light_ticket;cd011547passes 32 tests, 5 Windows-only skips. On main753fb5afthe newMixedVersionsclass fails both tests:(None, 'light') != ('exclusive', 'heavy')andtiming starts beside light.py_compilepasses.Suite: not run on
cd011547;ab.lockis held bymemrefit-head-off-cleanuntil 15:06 and the queue has the L3 game run, the launch PASS and a shader capture. The suite atab56489c(934/5/18) is the last full run; the PR goes back to WIP with themise run testbox unticked until the new head's suite runs.No game,
abrunor queue job was run.fix(queue): a light suite waits for a timed run or gameto WIP: fix(queue): a light suite waits for a timed run or game@review
cd011547621fc445b94cSee #2403
1fc445b94c448c312f21Correcting my earlier mapping, which was of the superseded
1fc445b9: this head is448c312f.caf690e6): that turn is inconflict()onmainnow.mainnow allows a light check beside agpu/sharedgame, and we are not re-fighting that.FREE_GB,FREE_SHARE = 0.4andmemory_short(s, mode)— the baseLONGSHOT_QUEUE_MIN_FREE_GBplus the mode's need, capped at 40% of the PC's RAM.The mixed-version half of this is still open on main; #2257 no longer carries it: #2403 landed the serialization without
protocol/kind.WIP: fix(queue): a light suite waits for a timed run or gameto WIP: fix(queue): a job's free-memory floor follows its mode and the PCTesting corrected: the 5-job suite at
448c312fexists (941/20/18, log sha256 90ddf528c12d53c84de0becf7680a9ec557af124ed69e7f1a636871a88d503ef); Still to test: None.WIP: fix(queue): a job's free-memory floor follows its mode and the PCto fix(queue): a job's free-memory floor follows its mode and the PCView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.