Repository navigation
Mark a force-stopped job done before releasing its shared slot - #55
Merged
Merged
Conversation
The force-stop loop released a shared SemaphoreSlim slot before setting SlotReleased. A stop landing between the two had the teardown release the slot again, leaving the shared budget one above its limit. The finalize passes already mark first; the force-stop loop and the teardown now do too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The harness check now requires the statement right before each shared-budget release to be the job's mark, not any mark earlier in the loop. The teardown comment no longer says a marked job's slot is always released already. 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. When the dispatcher force-stops jobs after an abort, it released each job's shared
SemaphoreSlimslot first and marked the job done after. If a stop landed between those two statements (a third Ctrl+C hands the stop to PowerShell), the teardown infinallysaw the job as still running and released its slot a second time. The shared budget then stayed one above the limit you set for the rest of the script. Or, if the semaphore has a maximum, the extra release threw and was swallowed. The finalize passes already mark the job first.What changed. The force-stop loop now marks the job done before releasing, like the finalize passes. The
finallyteardown does the same, so the two blocks stay in step; nothing can stop afinally, so that copy couldn't misfire. Either order leaves a one-statement window. Marking first can leak one slot instead, which is the failure the finalize passes already chose.How it was tested. The window is one statement wide, too narrow to hit from a test. New harness section AL reads the dispatcher's code instead. It checks that the statement right before each
if ($pkIsSharedBudget) { ...Release() }marks the job done. Onmainit fails (4 of 6), and with this change it passes (6 of 6). The full harness passes on Windows PowerShell 5.1 and PowerShell 7.6 (469 assertions each).🤖 Generated with Claude Code