Re: [PATCH v3 1/4] loose: use finite timeout when locking "loose-object-idx" file
- From
Karthik Nayak <karthik.188@gmail.com>
- Date
- Oct 30, 2026, 10:43 UTC
- Message-ID
- <CAOLa=ZSs05h9h+5+tdE=PA3ebj8U_8oj+qcstxZVcefpSY+Rcg@mail.gmail.com>
- In-Reply-To
- <20261029232220.1245827-2-jltobler@gmail.com>
Justin Tobler <jltobler@gmail.com> writes:
Show 13 quoted lines
> Loose object index file writers first attempt to acquire a lock via > `repo_hold_lock_file_for_update_timeout()` and specify a timeout value > of -1. With a negative timeout value, the lock acquisition retries > indefinitely while the lockfile still exists. If a process dies while > holding the lock and leaves a stale lockfile behind, every subsequent > writer of the mapping file hangs forever instead of reporting an error. > > Introduce LOOSE_OBJECT_IDX_LOCK_TIMEOUT_MS to set the timeout to 1000ms > and use it for all callers that lock a "loose-object-idx" file. A value > of 1000ms matches the default timeout used for "core.packedRefsTimeout" > and should provide concurrent writers sufficient time to acquire the > lock. >
I was wondering why we don't use a config here too. Seems like Patrick also mentioned the same in his review. But this is a good middle step and we can add that in later.
#leftoverbits
[snip]