Re: Credential Store: Don't acquire lock when only reading the file
- From
Simão Afonso <simao.afonso@powertools-tech.com>
- Date
- Oct 30, 2020, 12:05 UTC
- Message-ID
- <20201030120540.dna7k3bmnrrw4cck@safonso-t430>
- In-Reply-To
- <20201030055541.GA3264588@coredump.intra.peff.net>
On 2020-10-30 01:55:41, Jeff King wrote:
> - teach it to try the lock until hitting a timeout. I think just > swapping out hold_lock_file_for_update() for > hold_lock_file_for_update_timeout() would do it (I probably > would have used it back then, but it didn't exist yet).
So I tried to patch the credential store with that timeout function and it seems to solve it! Thanks.
https://github.com/git/git/blob/v2.29.2/builtin/credential-store.c#L61
This is easily reproduced if you do a `fetch --all` in parallel on the same repository (seen on the attached image):
> $ for n in $(seq 100); do git fetch --all; sleep 0.5; done
About the timeout, I put it at infinite retries, but should this be configurable? Or should it be a different default?
There aren't many timeout configurations. I found "core.filesRefLockTimeout" and "core.packedRefsTimeout", doesn't sound like something that should be re-used. Should it be something like this with a different name?