Repository navigation
Use only -JobPollCompleted's last value, so a leaked one can't finalize a running job - #49
Merged
Merged
Conversation
…ze a running job Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What was wrong: the dispatcher tested the whole output of
-JobPollCompleted. A poll that leaks a value before its answer, such as{ param($job) $list.Add(1); $job['Proc'].HasExited }with anArrayList, is therefore truthy while the program is still running. The job was finalized withHasExited = $false, and its process was disposed and its slot freed while it ran.-JobBuilder,-JobStarterand-NextJobProvideralready ignore stray output.What changed: only the poll's last output value counts, the same way in all three poll passes. The help and README say so.
Tested: new harness assertion: that leaky poll on a short
ping. Before the fix, on 5.1 and 7, the job was finalized on the first poll withHasExited = $false. After, it's finalized once, after the program exits. Full harness passes on Windows PowerShell 5.1 and PowerShell 7. The 20,000-job bookkeeping check took 2.8 s on 5.1 and 1.6 s on 7 locally.🤖 Generated with Claude Code