Skip to content

Bump retries, add backoff/jitter, fully reopen TreeFS on retry#131

Merged
jallum merged 1 commit into
mainfrom
fix-ref-moved-retry
May 30, 2026
Merged

Bump retries, add backoff/jitter, fully reopen TreeFS on retry#131
jallum merged 1 commit into
mainfrom
fix-ref-moved-retry

Conversation

@jallum

@jallum jallum commented May 30, 2026

Copy link
Copy Markdown
Owner

Three attempts is not enough under sustained contention — the race can win the CAS check between Refresh and Commit on every attempt even when Refresh correctly observes the new ref. Bump retries to 12 and add exponential backoff with full jitter so colliding writers desynchronize.

Also: rather than just Refresh (which reuses the same go-git Repository handle), fully reopen the TreeFS between attempts. Adds Repo.Reopen and Store.ReopenFS via a new Reopener interface. Defense in depth against any cached go-git state (packed-refs cache etc.) that Refresh might miss.

Three attempts is not enough under sustained contention — the race can
win the CAS check between Refresh and Commit on every attempt even when
Refresh correctly observes the new ref. Bump retries to 12 and add
exponential backoff with full jitter so colliding writers desynchronize.

Also: rather than just Refresh (which reuses the same go-git Repository
handle), fully reopen the TreeFS between attempts. Adds Repo.Reopen and
Store.ReopenFS via a new Reopener interface. Defense in depth against
any cached go-git state (packed-refs cache etc.) that Refresh might miss.
@jallum jallum merged commit 312c615 into main May 30, 2026
1 check passed
@jallum jallum deleted the fix-ref-moved-retry branch May 30, 2026 12:06
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.

1 participant