Keep compile memory reservations per invocation #1047

Merged
monsterlag merged 1 commit from fix/compile-memory-leases into main 2026-11-09 15:15:28 +00:00
monsterlag commented 2026-11-09 08:02:48 +00:00 (Migrated from github.com)

Compiling one source into separate WebGPU and Vulkan objects can overlap. The memory gate keyed both jobs by the source path, so one job could overwrite the other's reservation and then remove it before started() registered its process, raising KeyError and undercounting reserved memory.

Give each compile invocation its own lease and use it for process registration and cleanup. Memory estimates, RSS accounting, minimum concurrency, worker sizing, scheduling, cache keys and compiler-error handling remain unchanged.

Checks: the actual MemoryGate and compile_one regression deterministically reproduces the original KeyError and lost reservation, then verifies separate reservations, child mappings, compiler/process-creation error cleanup and cache bypass. The existing memory-policy and compiler-failure tests also pass through the focused strict runner on Windows and Linux (3 checks on each). No native compiler, game build or memory-pressure test was run.

Refs #1029. This addresses its Windows bookkeeping traceback. The AppImage missing-header symptom mentioned in that thread was independently fixed by #1012.

All hosted checks on c4a4d053 pass: Linux source regressions, Windows source regressions, Windows Vulkan renderer, Builder packaging, AppImage packaging, SPIR-V checks and workflow lint. Release publishing was intentionally skipped for this pull request.

Release integration: the official v2.0.8-rc.2 and rc.3 history contains this fix through merge commit 64fdba2. GitHub's PR metadata remains open while the default main branch is at a different revision; this note records released-source incorporation separately from a formal PR merge.

Compiling one source into separate WebGPU and Vulkan objects can overlap. The memory gate keyed both jobs by the source path, so one job could overwrite the other's reservation and then remove it before `started()` registered its process, raising `KeyError` and undercounting reserved memory. Give each compile invocation its own lease and use it for process registration and cleanup. Memory estimates, RSS accounting, minimum concurrency, worker sizing, scheduling, cache keys and compiler-error handling remain unchanged. Checks: the actual `MemoryGate` and `compile_one` regression deterministically reproduces the original `KeyError` and lost reservation, then verifies separate reservations, child mappings, compiler/process-creation error cleanup and cache bypass. The existing memory-policy and compiler-failure tests also pass through the focused strict runner on Windows and Linux (3 checks on each). No native compiler, game build or memory-pressure test was run. Refs #1029. This addresses its Windows bookkeeping traceback. The AppImage missing-header symptom mentioned in that thread was independently fixed by #1012. All hosted checks on `c4a4d053` pass: [Linux source regressions](https://github.com/NotRexed/Hookshot/actions/runs/42583162077/job/129046524554), [Windows source regressions](https://github.com/NotRexed/Hookshot/actions/runs/42583162077/job/129046524153), [Windows Vulkan renderer](https://github.com/NotRexed/Hookshot/actions/runs/42583161938/job/129046523391), [Builder packaging](https://github.com/NotRexed/Hookshot/actions/runs/42583161938/job/129046523676), [AppImage packaging](https://github.com/NotRexed/Hookshot/actions/runs/42583162111/job/129046524356), SPIR-V checks and workflow lint. Release publishing was intentionally skipped for this pull request. Release integration: the official v2.0.8-rc.2 and rc.3 history contains this fix through merge commit [64fdba2](https://git.magicbean.dev/MagicBeanDev/Hookshot/commit/64fdba2). GitHub's PR metadata remains open while the default main branch is at a different revision; this note records released-source incorporation separately from a formal PR merge.
Commenting is not possible because the repository is archived.
No description provided.