Skip to content

bugfix: Check the mirror existence while holding the mirror lock - #161

Merged
seeraven merged 2 commits into
seeraven:masterfrom
mering:bugfix/new-mirror-race
Sep 11, 2026
Merged

seeraven merged 2 commits into
seeraven:masterfrom
mering:bugfix/new-mirror-race

Conversation

@mering

@mering mering commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

The database was queried for the existence of the mirror before the mirror lock was acquired. Two gitcache processes starting with an empty cache both saw a missing mirror, so the process getting the lock as the second one deleted the mirror the first one had just created and cloned it again, breaking the operations of the other processes on that mirror.

Query the database while holding the lock.

The database was queried for the existence of the mirror before the mirror
lock was aquired. Two gitcache processes starting with an empty cache both
saw a missing mirror, so the process getting the lock as the second one
deleted the mirror the first one had just created and cloned it again,
breaking the operations of the other processes on that mirror.

Query the database while holding the lock.

Co-authored-by: Cursor <cursoragent@cursor.com>
@seeraven seeraven self-assigned this Sep 11, 2026

@seeraven seeraven left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch of this race condition! Again, feel free to give yourself credit for this nice finding and fix.

@seeraven
seeraven merged commit 4146206 into seeraven:master Sep 11, 2026
10 checks passed
@mering
mering deleted the bugfix/new-mirror-race branch September 11, 2026 15:13
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