Repository navigation
Prevent concurrent writers on the same Git repository - #1277
Merged
Merged
Conversation
clementbiron
self-requested a review
September 24, 2026 08:19
clementbiron
approved these changes
Sep 24, 2026
Member
|
Seen in sync with @Ndpnt |
A lock left by a killed process whose PID is reused by its replacement, such as the same container restarted, was acquired again silently but never registered, so it was not released when that replacement exited. It then outlived every writer and, with a lingering PID, refused the next one for no reason.
clementbiron
force-pushed
the
writer-lock
branch
from
September 24, 2026 08:33
42c2274 to
a289297
Compare
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.
Two writers on the same Git repository, typically a second
ota trackstarted by hand while the scheduled tracker runs, race the working tree and the index: one fails, or its clean up discards the uncommitted changes of the other. #1273 made the readers safe, this handles the writers.A writer now takes a lock file in
.git/ota-writer.lock, holding its PID, and keeps it until the process exits. A second writer refuses to start with an error naming the holder. A lock left by a killed process is detected as stale and taken over atomically.The
index.lockleft behind by a killed Git operation is also removed at each run, as it made the tracker fail at every restart.