Repository navigation
Bound the stderr drain when an inhibitor helper exits at startup [patch] - #45
Open
matt-edmondson wants to merge 1 commit into
Open
matt-edmondson wants to merge 1 commit into
matt-edmondson wants to merge 1 commit into
Conversation
ChildProcessHold.Start waited for the helper's redirected streams with an untimed WaitForExit after the helper had exited. A background child that inherited the helper's stderr kept the pipe open for as long as it ran, so Start (inside the blocker's and controller's locks) hung with it. Wait for stderr's end of input for at most one second instead, then report whatever stderr arrived by then. Fixes #43 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW5nyEDqgqjU6AtLLLi
|
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 #43
What was wrong
When the helper exited within
StartupGrace,ChildProcessHold.Startcalled the untimedprocess.WaitForExit()to collect the last stderr lines. With redirected output, that call also waits for both pipes to reach EOF. A background child that inherited the helper's stderr keeps the pipe open for as long as it runs, soStarthung for that long. It hung insideLinuxSleepBlocker's andKeepAwakeController's locks, soIsActive, toggles andDisposequeued behind it.Change
StartupErrorOutputnow records thenullline thatErrorDataReceiveddelivers at end of input, using aTaskCompletionSource(nothing to dispose, so a late callback can't hit a disposed handle).Startwaits for that end of input for at mostExitDrainTimeout(1 s), then reads whatever stderr has arrived and throws the sameSleepBlockExceptionas before.Kill(entireProcessTree)on the dead helper can't reach it.Tests
Start_WhenTheHelperExitsLeavingAChildOnItsStandardError_ThrowsWithoutWaitingForTheChild. The helper writes a reason to stderr, startssleep 20 &, and exits 1. The test checks thatStartthrows within 5 s and that the message includes the stderr line. It is Inconclusive off Unix, like the other helper tests.Generated by Claude Code