Re: BUG: Race condition due to reflog expiry in "gc"
To
Ævar Arnfjörð Bjarmason
Cc
Junio C Hamano
Git List
Nguyễn Thái Ngọc Duy
Michael Haggerty
Stefan Beller
Jonathan Nieder
From
Jeff King
See Also
Prev Ref 1 Ref 2 Ref 3 Ref 4
Date
2019-03-14 00:25:00 UTC
On Wed, Mar 13, 2019 at 05:22:22PM +0100, Ævar Arnfjörð Bjarmason wrote:

> > That's what the retry-with-timeout is supposed to address, so maybe it
> > works. But I wouldn't be surprised if it's insufficient in practice,
> > since the reflog code may walk big parts of the graph under lock,
> > checking reachability.
> 
> I suppose this can happen if the reflog for a given branch is so big
> that it takes us more than 100ms to parse it, but e.g. O(n) refs
> shouldn't matter, since we only hold the lock on one ref at a time.

I think it's more than parsing, though.

It's been a while since I've dug into the reflog expiration code, but my
recollection is that it can actually walk parts of the graph (looking
for what's reachable) while processing the reflog. That can be tens of
seconds in decent-sized repositories.

-Peff