🪲 BUG-#68: Fix busy-wait loop and enable multiprocessing on macOS via fork context#78
Merged
FernandoCelmer merged 8 commits intodevelopfrom Mar 26, 2026
Merged
🪲 BUG-#68: Fix busy-wait loop and enable multiprocessing on macOS via fork context#78FernandoCelmer merged 8 commits intodevelopfrom
FernandoCelmer merged 8 commits intodevelopfrom
Conversation
FernandoCelmer
commented
Mar 26, 2026
Member
Author
FernandoCelmer
left a comment
There was a problem hiding this comment.
🔍 Code Review
Code issues found: 2
See inline comments below.
FernandoCelmer
commented
Mar 26, 2026
Member
Author
FernandoCelmer
left a comment
There was a problem hiding this comment.
🔍 Code Review
Code issues found: 3
| # | Severity | Comment |
|---|---|---|
| 1 | [Suggestion] | Windows spawn — bound method pickling risk |
| 2 | [Blocking] | SequentialGroup: broad exception + silent task masking |
| 3 | [Blocking] | Parallel: broad exception + silent task masking |
c9282a9 to
a4f3c63
Compare
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.
Description
multiprocessing.Process/Queuewithget_context("fork")on POSIX andget_context("spawn")on Windows; removedis_darwin()platform checks and macOS fallback warnings; replaced busy-wait polling loop with blockingqueue.get(timeout=0.1)catchingqueue.Empty; simplifiedSequentialGroup.run()by removing the intermediate thread layer; added_processeslist for liveness tracking; addedelsefallback to mark tasks asTypeStatus.FAILEDwhen a worker process terminates without reporting a result; importedTaskErrorfor structured error wrappingParallelandSequentialGroupdo not deadlock when a task fails before putting to the queueforkon POSIX,spawnon Windows)get_context()get_context()requestsdependencyMotivation and Context
The
ParallelandSequentialGroupmodes had two critical bugs:while not queue.empty(): queue.get()loop consumed 100% CPU while waiting for task results.spawnon macOS, causing bound methods to fail silently in child processes — the original code worked around this withis_darwin()checks that degraded to sequential execution.Additionally, if a worker process terminated without calling
queue.put()(e.g., due to an unhandled exception not caught byExecution), the collection loop would deadlock indefinitely.This PR fixes all three issues: forces
forkcontext on POSIX (enabling macOS parallel mode), replaces busy-wait with a timeout-basedqueue.get(), adds process-liveness detection to break out of the collection loop safely, and marks unreported tasks asFAILEDto ensureon_failurecallbacks fire correctly.Closes #68
Types of changes
Checklist