Skip to content

fix(vulkan): count only successfully queued background jobs - #129

Draft
soltros wants to merge 2 commits into
mainfrom
fix/queue-acceptance-count
Draft

soltros wants to merge 2 commits into
mainfrom
fix/queue-acceptance-count

Conversation

@soltros

@soltros soltros commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

A rejected background-job enqueue currently increments the pending count even though no job was accepted. Genuine allocation fault injection against the real vk_jobs.cpp reproduces pending=12 with only 11 queued jobs. Count entries after successful deque insertion instead.

Both queue insertion and the counter update remain under the same mutex, before worker notification, so workers cannot remove an entry before it is counted. An insertion exception still propagates; this change corrects accounting and does not claim to recover a failed shader Program or limit queue memory.

The new game-free fixture compiles the real job implementation with the existing platform stubs, forces deque allocations to throw, and checks unchanged queue size/pending count, successful retry, and return to zero after draining accepted jobs. Eight rejected enqueues cover front/back insertion. Workers are intentionally not started for this deterministic acceptance test; the existing actual-worker/wait-stealing test also passes. The new regression fails on unchanged main and passes with the fix under GCC warnings-as-errors. No driver, game content or actual system OOM is involved.

Found during the #18 audit; it is not evidence that this caused the original gameplay memory growth. Also updates #128's worklist status to merged. Published tree 55a441818c716b447535ba799fe6ce042080bc8c matches the local staged tree. Full local suite: 285 passed, the same 12 known host/tool-dependent failure paths, and 56 skipped. Hosted Windows/Linux suites and packaging are running. Source audit finds jobs_pending currently read for replay diagnostics; this corrects the reported pending count and is not a demonstrated queue hang or memory leak. Keep draft until validation completes.

Windows fixture follow-up: the first hosted head passed Linux and both packaging builds, but Windows rejected C-runtime getenv deprecations under warnings-as-errors. The fixture now defines _CRT_SECURE_NO_WARNINGS on Windows, matching other native fixtures while keeping -Wall/-Wextra/-Werror. All eight cases still pass locally; fresh CI runs on b0af68d (tree 566af074f6a11c711f6209a2a6da7e7503c8e425).

@soltros soltros mentioned this pull request Nov 11, 2026
3 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant