Skip to content

alternate approach to fixing fsmonitor hangs

Jeff King git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2simple-ipc: split async server initialization and runningbuiltin/fsmonitor--daemon.c compat/simple-ipc/ipc-shared.c compat/simple-ipc/ipc-unix-socket.c +2 more+88 -180 replies
2/2fsmonitor: initialize fs event listener before accepting clientsbuiltin/fsmonitor--daemon.c compat/fsmonitor/fsm-listen-darwin.c compat/fsmonitor/fsm-listen-win32.c+12 -20 replies

Reviews trailers per patch

None of the 2 patches has a Reviewed-by or Acked-by.

PatchKoji Nakamaru
1/2
2/2Helped-by

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/2] alternate approach to fixing fsmonitor hangs
Quoted 8 lines · Koji Nakamaru

Review

Quoted 6 lines
(quoted diff) +3 -1
-     pthread_mutex_lock(&server_data->work_available_mutex);
+     /* If we haven't started yet, we are already holding lock. */
+     if (!server_data->started)
+             pthread_mutex_lock(&server_data->work_available_mutex);
 
      server_data->shutdown_requested = 1;

Is this condition inverted?

Yes, good catch.

Quoted 5 lines
Quoted 2 lines

I had also previously checked my suggested solution. So I do think either is a valid solution to the problem.

I also tested your approach on Windows with a few additions to ipc-win32.c, and it worked correctly.

Yeah, I never even tried building mine on Windows, and was just testing via tmate on our macOS CI environment. :-/

I've added in the necessary Windows bits, along with smoothing a few rough edges. Especially with the extra Windows changes (which I mostly had to guess-and-check by pushing to CI), I'm beginning to wonder if my solution isn't getting a bit too complicated, and maybe yours was the right way after all.

But I've cleaned it up for presentation here, so at least we can look at the final form of both and see which we prefer.

[1/2]: simple-ipc: split async server initialization and running [2/2]: fsmonitor: initialize fs event listener before accepting clients

 builtin/fsmonitor--daemon.c          |  6 ++--
 compat/fsmonitor/fsm-listen-darwin.c |  6 ++++
 compat/fsmonitor/fsm-listen-win32.c  |  6 ++++
 compat/simple-ipc/ipc-shared.c       |  5 +--
 compat/simple-ipc/ipc-unix-socket.c  | 28 +++++++++++++---
 compat/simple-ipc/ipc-win32.c        | 48 +++++++++++++++++++++++++---
 simple-ipc.h                         | 17 +++++++---
 7 files changed, 98 insertions(+), 18 deletions(-)

-Peff