Fix save overlap dangling reference - #15
Merged
Merged
Conversation
Run with `zig test src/test_gold_all.zig --test-filter "disk save with overlap" --test-cmd timeout --test-cmd 30s --test-cmd-bin` because the issue causes the code to hang
Also Heap-allocate shared state and harden cleanup, synchronization, and slot-release paths
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix disk-save overlap coordinator lifetime
Summary
Fixes a lifetime bug where the background save worker received a pointer to coordinator state embedded in a
SaveOverlapvalue that was subsequently moved. The coordinator now uses stable heap storage with ordered initialization rollback and teardown.The change also synchronizes save-worker error reads and returns acquired slots to the pool when rasterization or publication fails.
Testing
Confirmed in Debug and ReleaseSafe:
.both.Before this fix, the overlap regression hung until the timeout exited with code 124.
CI follow-up
Once #11, which adds CI, is merged, the disk-save overlap test should be added to CI with an external timeout so future deadlocks fail deterministically. eg
zig test -O ReleaseSafe src/test_gold_all.zig --test-filter "disk save with overlap" --test-cmd timeout --test-cmd 30s --test-cmd-bin