Repository navigation
robust-checkout: clear stale git locks left by a hard-killed fetch - #18
Merged
Merged
Conversation
A fetch killed by 'timeout -s KILL' (SIGKILL is uncatchable) can't clean up after itself, leaving .git/shallow.lock (from a shallow/depth fetch) and possibly index.lock/fetch-head.lock behind. Every subsequent fetch then aborts with "Unable to create '.../shallow.lock': File exists / Another git process seems to be running", so a single killed round silently poisons all later rounds — observed in FlagGems run 40832357195 where rounds 4-5 failed on the stale lock rather than the network. Remove stale *.lock at the start of each fetch attempt. Nothing else touches the repo (the only prior git was the one we just killed), so this is safe and is the only way the retry loop can recover from a hard-killed fetch.
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.
Fix: a fetch killed by 'timeout -s KILL' (SIGKILL, uncatchable) leaves .git/shallow.lock (and possibly index.lock/fetch-head.lock) behind, so every later round aborts with 'File exists / Another git process seems to be running' — observed in FlagGems run 40832357195 where rounds 4-5 failed on the stale lock, not the network. Remove stale *.lock at the start of each fetch attempt; nothing else touches the repo, so it is safe and is the only way the retry loop can recover after a hard-killed fetch. Verified: YAML valid, bash -n clean, cleanup removes the locks while keeping real .git files.