git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Patrick Steinhardt <ps@pks.im>
Date
Aug 13, 2026, 09:03 UTC
Message-ID
<an2IT78KDS94JqUt@pks.im>
In-Reply-To
<CAJ-ks9kQR77vH-56eS9tT-iXEnih+Z7SPRMs1gD_wTyg_6gZ_w@mail.gmail.com>
On Wed, Aug 12, 2026 at 09:19:08PM -0400, Tamir Duberstein wrote:
> On Tue, Aug 11, 2026 at 12:45 PM Tamir Duberstein <tamird@gmail.com> wrote:
[snip]
Show 14 quoted lines
> > Got it. I agree with you that the flush call feels unnecessary under
> > the interpretation that passing 1ms to FSEventStreamCreate is the
> > equivalent of asking it to flush every 1ms. Empirically, though,
> > that's not the case, as described in the commit message.
> >
> > There's more precedent for this technique (found by agent, sorry):
> > watchman fixed a similar issue here:
> > https://github.com/facebook/watchman/commit/d1795de4ecab33672a89802318fe6f0122462194
> > and the documented it here:
> > https://github.com/facebook/watchman/commit/2f80886991ce81585ac0679c2b019fa0e4d9e9dd
> >
> > I agree this is unsatisfying.
> >
> > Does that help?
Those links definitely help to provide some more context, thanks!
> I did a bunch more digging and I'm withdrawing this patch. I haven't
> succeeded in proving that this fixes the performance issue. I'll
> resend in case this changes.

One major difference I notice there is that your patch uses `FsEventStreamFlushAsync()`, whereas Watchman uses the `Sync()` variant. That could help explain why it works for their use case, as the can now guarantee that the cookie was indeed processed once that call finishes. But with our `Async()` variant that's a guarantee that we cannot uphold, and consequently we're essentially still racing with the timout.

Now we could of course try to use the synchronous variant ourselves. But I'm a bit concerned that this may create new problems that we don't really understand yet. Quite unfortunate indeed :/

Thanks!
Patrick
Previous: Tamir DubersteinNext: Junio C Hamano
Message 10 of 11 in “fsmonitor: flush pending FSEvents before cookie wait”
  1. fsmonitor: flush pending FSEvents before cookie waitTamir Duberstein, Jul 21, 2026
  2. Koji NakamaruJul 24, 2026
  3. Junio C HamanoJul 24, 2026
  4. Junio C HamanoAug 4, 2026
  5. Patrick SteinhardtAug 5, 2026
  6. Tamir DubersteinAug 11, 2026
  7. Patrick SteinhardtAug 11, 2026
  8. Tamir DubersteinAug 11, 2026
  9. Tamir DubersteinAug 13, 2026
  10. Patrick SteinhardtAug 13, 2026
  11. Junio C HamanoAug 11, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.