Skip to content
This repository was archived by the owner on Nov 16, 2026. It is now read-only.

Fix timer, GPU callback and runtime shutdown races - #2

Draft
AlenHay wants to merge 3 commits into
NeverCookFirst:codex/native-rendererfrom
AlenHay:codex/sdk-runtime-correctness-20261007
Draft

AlenHay wants to merge 3 commits into
NeverCookFirst:codex/native-rendererfrom
AlenHay:codex/sdk-runtime-correctness-20261007

Conversation

@AlenHay

@AlenHay AlenHay commented Oct 7, 2026

Copy link
Copy Markdown

Timer enqueue can race closure or shutdown, GPU interrupt address/data can be observed inconsistently, and teardown can unpublish the dispatcher while workers still use it. This change serializes closure-sensitive timer claims, publishes callback state coherently, preserves interrupt TLS on lookup failure, stops vblank before destroying its processor, and keeps the runtime dispatcher published until final workers join. It also rejects malformed D3D12/Vulkan shader-cache records and honors UI shutdown before deferred launch.

Validation from the tested integration: bounded production-body fixtures cover timer waits/lifecycle, callback concurrency, interrupt TLS, graphics/runtime shutdown, cache bounds, Vulkan pipeline storage and app launch. The selected SDK suite passed 225 checks with four existing BitStream skips; PPC execution was excluded because its target was not built. Windows runtime and all consumers were rebuilt together.

Public atomic storage changes require rebuilding the runtime and every consumer together. These regressions do not prove universal teardown safety or a crash-free campaign.

This is an independent draft against codex/native-renderer (dependency PR #1). The related SDK PRs share only test-registration infrastructure; their combined production/test files match the validated integration 2897c31b1407dd96480dc25965f8ee7807f00e0f. CMake registrations were restricted to each PR's fixtures and checked for missing files. These isolated branches were not separately rebuilt; validation above describes the prior integration run, not new CI results.

The exact tested integration is published at https://github.com/AlenHay/rexglue-sdk/tree/codex/runtime-correctness-20261007 for the renderer dependency pin. Game inputs, generated game code, shader banks, captures and saves are excluded.

Publish callback address/data coherently, synchronize the shared frame counter, preserve TLS after a failed interrupt lookup, validate shader-cache lengths, and stop vblank before destroying its command processor. Abort deferred module launch when its prelaunch hook requests UI shutdown.

Validate production bodies with bounded concurrent, storage, dispatch, and launch fixtures. Gate host-executed regressions out of cross builds. Public atomic storage changes require rebuilding the runtime and every consumer together; this does not establish full runtime teardown safety.
Delay singleton removal until graphics, audio, input, and kernel shutdown complete, then clear it before dispatcher destruction. This keeps final indirect guest callbacks resolvable. Production-body concurrent fixture covers partial/repeated teardown, failure retry, foreign instance ownership, and the old early-clear failure.

This does not solve existing guest thread stragglers or arbitrary concurrent runtime destruction.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant