Skip to content

fix(git): stop snapshot generation from stalling every request - #412

Merged
worstell merged 1 commit into
block:mainfrom
luispadron:luis/repo-lock-hot-fields
Sep 30, 2026
Merged

worstell merged 1 commit into
block:mainfrom
luispadron:luis/repo-lock-hot-fields

Conversation

@luispadron

@luispadron luispadron commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Ref-check and last-fetch bookkeeping took the repository RWMutex for writing on every request and every fetch. Snapshot generation holds that lock for reading for minutes on large mirrors, and a queued writer parks every new reader behind it, so serving hung until generation finished. The bookkeeping now lives under its own mutex; only state transitions write the repository lock.

Also fetch and retry the mirror when upload-pack reports "not our ref" before forwarding to upstream. On busy repositories the missing object is usually a commit the stale mirror has not fetched yet, and forwarding proxied the whole pack from upstream.

Tests: quay.io/minio/minio is no longer published (CI has been failing on main since Sep 24), so the S3 test container now uses cgr.dev/chainguard/minio.

@luispadron
luispadron force-pushed the luis/repo-lock-hot-fields branch from 9d0aa1b to 041d4dd Compare September 30, 2026 16:29
@luispadron
luispadron marked this pull request as ready for review September 30, 2026 16:31
@luispadron
luispadron requested a review from a team as a code owner September 30, 2026 16:31
@luispadron
luispadron requested review from jrobotham-square and removed request for a team September 30, 2026 16:31
Ref-check and last-fetch bookkeeping took the repository RWMutex for
writing on every request and every fetch. Snapshot generation holds that
lock for reading for minutes on large mirrors, and a queued writer makes
RWMutex park every new reader behind it, so serving (State(), for-each-ref,
snapshot downloads) hung until generation finished and clients timed out.
Move the bookkeeping to its own mutex so only state transitions ever write
the repository lock.

Also fetch and retry the mirror when upload-pack reports "not our ref"
before forwarding to upstream: on busy repositories the missing object is
almost always a commit the stale mirror simply has not fetched yet, and
forwarding proxied the entire pack from upstream.

Tests: the quay.io/minio/minio image is no longer published, so the S3
test container now uses cgr.dev/chainguard/minio.
@luispadron
luispadron force-pushed the luis/repo-lock-hot-fields branch from 041d4dd to 7861357 Compare September 30, 2026 17:24
@worstell
worstell merged commit 57af02d into block:main Sep 30, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants