Repository navigation
Close interleaved prefetch workers concurrently - #1430
Open
jabrailkhalil wants to merge 2 commits into
Open
jabrailkhalil wants to merge 2 commits into
jabrailkhalil wants to merge 2 commits into
Conversation
This branch has not been deployed
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.
Fixes #1410.
I start closing the active interleave children before waiting for their cleanup, so independent
mp_prefetchworker exit delays overlap instead of accumulating one worker at a time.Closing remains blocking and idempotent: iterator prefetch is stopped first, every child cleanup is joined, and a child exception is propagated after the remaining children have finished. The zero/single-child path stays synchronous. Final interpreter GC also stays synchronous: Python 3.11 can hang when starting a thread during finalization. If thread creation is unavailable during normal cleanup, that child's close runs synchronously. Worker stop events, join/kill timeouts and data/checkpoint semantics are unchanged.
Validation
atexit/final-GC subprocesses. The final-GC subprocess assertssys.is_finalizing()is actually true.Controlled shutdown measurement on Windows / CPython 3.12.10, with a 300 ms
atexitdelay in each real spawned worker (median of three runs):All 18 base/final measurements confirmed the requested number of distinct worker PIDs and no live workers after
close(). This measures shutdown latency, not data throughput. Scalar outputs isolate this issue from the separate shared-memory cleanup problem in #1420/#1421.For local Python tests I used the source Python code with the published 0.2.18 index-shuffle native extension; the full Bazel matrix builds the native extension from source.