Re: [PATCH] fsmonitor: flush pending FSEvents before cookie wait

Junio C Hamano <[email protected]> Tue, 04 Aug 2026 15:13:47 -0700
Newsgroups org.kernel.vger.git
Message-ID <[email protected]>
Koji Nakamaru <[email protected]> writes:

> On Wed, Jul 22, 2026 at 6:05 AM Tamir Duberstein <[email protected]> wrote:
>>
>> 56cef9cb1a (fsmonitor: use pthread_cond_timedwait for cookie wait,
>> 2026-04-15) limits the cookie wait to one second so that a filesystem
>> which never delivers events cannot hang fsmonitor clients. A client that
>> times out receives a trivial response and scans the entire index.
>>
>> FSEvents can defer delivery while it batches notifications and does not
>> guarantee that its queue is drained in one latency interval. A loaded
>> macOS system can therefore time out even though the event stream is
>> working.
>> ...
>
> This patch is carefully designed to minimize any risks. To drain events,
> we could also call FSEventStreamFlushSync before acquiring main_lock in
> do_handle_client(), but this patch should be sufficient if it mitigates
> the issue. The commit message would be much more convincing if you also
> included benchmark results showing how many timeouts were reduced.

Tamir, just to say that it is my understanding that the ball is in
your court.  It hasn't been _too_ long since the exchange happened,
but we expect people to respond review comments (either positively
or negatively) and without such discourse a topic would not move
forward, so ...

Thanks.