Skip to content

Use only -JobPollCompleted's last value, so a leaked one can't finalize a running job - #49

Merged
HalRiveria-Bot merged 1 commit into
mainfrom
fix/leaky-poll
Nov 17, 2026
Merged

HalRiveria-Bot merged 1 commit into
mainfrom
fix/leaky-poll

Conversation

@HalRiveria-Bot

Copy link
Copy Markdown
Collaborator

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 an ArrayList, is therefore truthy while the program is still running. The job was finalized with HasExited = $false, and its process was disposed and its slot freed while it ran. -JobBuilder, -JobStarter and -NextJobProvider already 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 with HasExited = $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

…ze a running job

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@HalRiveria-Bot
HalRiveria-Bot merged commit 799216d into main Nov 17, 2026
2 checks passed
@HalRiveria-Bot
HalRiveria-Bot deleted the fix/leaky-poll branch November 17, 2026 03:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants