Re: [PATCH v3 1/4] loose: use finite timeout when locking "loose-object-idx" file

From
Karthik Nayak <hidden>
Date
2026-10-30 10:43:14
Reply to
Justin Tobler, 2026-10-29
Justin Tobler [off-list ref] writes:
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]

Attachments

Thread (34 messages) 34 messages, 4 authors, last reply 2d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help