Re: [PATCH] fsmonitor: fix hangs by delayed fs event listening
- From
Jeff King <peff@peff.net>
- Date
- Oct 7, 2024, 06:08 UTC
- Message-ID
- <20241007060813.GA34827@coredump.intra.peff.net>
- In-Reply-To
- <20241007055821.GA34037@coredump.intra.peff.net>
On Mon, Oct 07, 2024 at 01:58:21AM -0400, Jeff King wrote:
> I think your patch has one small bug, which is that you don't > pthread_mutex_destroy() at the end of fsmonitor_run_daemon(). But other > than that I think it should work OK (I haven't tried it in practice yet; > I assume you did?).
I just checked your patch in our CI, using the sleep(1) you suggested earlier to more predictably lose the race(). It does work reliably (and I confirmed with some extra trace statements that it does spin on the sleep_millisec() loop).
I had also previously checked my suggested solution. So I do think either is a valid solution to the problem.
-Peff