Re: [PATCH v7 04/10] fsmonitor: use pthread_cond_timedwait for cookie wait
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Mar 4, 2026, 07:42 UTC
- Message-ID
- <aafifU-befdZW4O0@pks.im>
- In-Reply-To
- <0a586709524f36c189cc32159b643a49abdbd51c.1772065643.git.gitgitgadget@gmail.com>
On Thu, Feb 26, 2026 at 12:27:17AM +0000, Paul Tarjan via GitGitGadget wrote:
Show 16 quoted lines
> From: Paul Tarjan <github@paulisageek.com> > > The cookie wait in with_lock__wait_for_cookie() uses an infinite > pthread_cond_wait() loop. The existing comment notes the desire > to switch to pthread_cond_timedwait(), but the routine was not > available in git thread-utils. > > On certain container or overlay filesystems, inotify watches may > succeed but events are never delivered. In this case the daemon > would hang indefinitely waiting for the cookie event, which in > turn causes the client to hang. > > Replace the infinite wait with a one-second timeout using > pthread_cond_timedwait(). If the timeout fires, report an > error and let the client proceed with a trivial (full-scan) > response rather than blocking forever.
One thing that I'd be happy to learn about is why specifically you have chosen one second as a timeout value. Are we sure this is always enough on a loaded system?
Patrick