Repository navigation
Make git timeouts kill a hung git - #84
Merged
Merged
Conversation
The timeout was a waitFor() after reading stdout to EOF, which a hung git never reaches, so no timeout ever fired. A field report had a fetch running for 2h 11m against its 90s limit. A shared reaper thread now kills git and its descendants when time runs out. The descendants matter: a fetch's ssh, or the shell behind an alias, holds the same stdout, so killing git alone would leave the read waiting. Signed-off-by: Raman Gupta <rocketraman@gmail.com>
rocketraman
force-pushed
the
claude/gitvantage-git-timeout
branch
from
November 4, 2026 15:14
07a7502 to
248bfa3
Compare
A timeout coroutine started next to the read, under one runBlocking parent, and cancelled when the read finishes, says what the shared reaper executor did in less code. Signed-off-by: Raman Gupta <rocketraman@gmail.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.
gittimeouts never fired.spawnNowread stdout to EOF and only then calledwaitFor(timeout), so a git that hangs, and never closes stdout, blocks forever. dave08's 1.5.0 log shows agit fetchthat ran for 2h 11m against its 90sNETWORK_TIMEOUT. Some of that may be the Mac sleeping, but nothing in the code could have stopped it. Every version is affected.Change
runBlockingparent. When the timeout passes, it kills git and all of git's child processes. If the read finishes first, the coroutine is cancelled. It runs onDispatchers.Default, becauserunBlocking's own thread is blocked in the read.sshand the shell behind an alias both hold git's stdout.Result(-1, out, "timed out"), as before.Testing
GitTimeoutsuite:!sleep 60alias with a 1s timeout now returns failure in about 1s; before the fix it would have blocked for the full 60s;