Sync main with release#309
Merged
Merged
Conversation
Unlinking a shared-memory segment that another process had already removed raised FileNotFoundError out of the owner's context exit, aborting pool teardown, and the raise skipped the atexit unregister so the fallback fired a second FileNotFoundError at interpreter shutdown. The failure is reliable under rapid same-namespace pool teardown and respawn, where a dying process's multiprocessing resource tracker unlinks the deterministically named segment out from under the owner. Owner exit now disarms the atexit fallback before unlinking and treats a missing segment as a no-op, the fallback closure suppresses the same error at shutdown, and the publisher block finalizer applies the same disarm-before-unlink ordering so a failed unlink can never leave a fallback armed.
Add regression tests for the double-unlink crash and the atexit fallback double-fire, then pin the surrounding teardown contracts: owner exit unlinks the segment, exceptional exit still tears down, non-owners neither arm fallbacks nor unlink, namespaces stay reusable across rapid enter/exit cycles, and overlapping same-namespace generations unwind cleanly. Recording atexit wrappers pin the disarm-before-unlink ordering for both the owner exit and the publisher block finalizer, where an unsuppressed unlink error is the only observable seam. Hypothesis properties generalize the regression cases across arbitrary lifecycle interleavings, vanishing-segment masks, and publisher add/drop sequences. Reword two overclaiming test docstrings to match what their bodies assert.
Exercise the reported reproduction shapes end to end with real worker pools: rapid same-namespace teardown and respawn, LIFO overlap, and owner-first exit with a post-overlap respawn. A cross-process test proves the genuine failure mechanism by letting an independent interpreter's resource tracker unlink the shared segment and asserting the owner still exits cleanly through real interpreter shutdown. A strict xfail pins the known surviving-pool worker leak so the suite flags its fix loudly when it lands.
A leaked-context owner interpreter shuts down with the atexit fallback still armed after an independent attacher's resource tracker unlinked the segment. The pre-fix bare lambda leaves an atexit traceback on stderr at shutdown; the suppressing closure shuts down silently. This is the first behavioral pin for the fallback's own suppression, which coverage cannot see because it runs in an unmeasured interpreter.
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.
Auto-generated by the sync branches workflow.