From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55286) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gLntY-0000Wx-Dd for guix-patches@gnu.org; Sun, 11 Nov 2018 06:27:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gLntV-0002yL-2F for guix-patches@gnu.org; Sun, 11 Nov 2018 06:27:11 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:41082) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gLntO-0002rO-Bv for guix-patches@gnu.org; Sun, 11 Nov 2018 06:27:04 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gLntO-0001Er-0y for guix-patches@gnu.org; Sun, 11 Nov 2018 06:27:02 -0500 Subject: [bug#33265] [WIP RFC v4] services: Add file system monitoring service. Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <20181105035122.4359-1-dannym@scratchpost.org> <20181105094109.21915-1-dannym@scratchpost.org> <87a7mgwp6e.fsf@gnu.org> <20181111011218.00265d2f@scratchpost.org> Date: Sun, 11 Nov 2018 12:25:45 +0100 In-Reply-To: <20181111011218.00265d2f@scratchpost.org> (Danny Milosavljevic's message of "Sun, 11 Nov 2018 01:12:18 +0100") Message-ID: <87wopjua86.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Danny Milosavljevic Cc: 33265@debbugs.gnu.org Hello! Danny Milosavljevic skribis: > On Sat, 10 Nov 2018 23:19:53 +0100 > ludo@gnu.org (Ludovic Court=C3=A8s) wrote: > >> Nice! Should we call it =E2=80=98fswatch-monitoring-service=E2=80=99, s= ince there may >> be other tools to achieve similar results? > > Its use is mostly to allow other Guix services to extend it in order to > do stuff on file change (for example restarting a service; starting the > user shepherd - the latter is what caused me to write this). > > I was very much tempted to call it "fswatch-monitoring-service", but that= 's > really an implementation detail - what it does is provide file change > notification services to other Guix services. > > It's not meant to be a generic fswatch service. I've not known fswatch > before writing this service - so it's pretty likely that there are tons > more features an fswatch user could want to use which the service doesn't > provide. Also, fswatch isn't really meant to be used as a daemon AFAIK, > so we are not providing fswatch to the user in the way it's supposed to be > used by him. OK, that makes sense. >> The =E2=80=98sleep=E2=80=99 call looks suspicious. :-) > > Pretty suspicious :) > > Right now, the service has only a very narrow usecase where rapid > notifications is not something one wants. On the contrary, both rapid > notifications and (in a pathological case where a watch couldn't be > registered - see the "/does_not_exist" workaround) rapid fswatch invocati= ons > would waste (potentially enormous amounts of) cpu time and would > forkbomb fswatch, shepherd and/or worse things. On the other hand, using > fswatch like we do now causes us to lose events. But so does starting fs= watch > later than the clients. And most fswatch backends (for example the Linux= one) > can lose events anyway (since the kernel buffer is limited - Linux will t= hen > drop events). That's why it always calls the handlers when restarting - = just > in case. Uh, not very confidence-inspiring. ;-) >> IIUC, the service stops (and is respawned) every time an even[t] occurs,= is >> that right? > > Yes. It's very simple :) OK that works, but I=E2=80=99m not very comfortable with the approach: norm= ally respawns indicate that the service failed unexpectedly, so here we=E2=80=99= re really abusing the mechanism IMO. >> Can=E2=80=99t we instead remove =E2=80=98--one-event=E2=80=99 and pass f= swatch a script to run? > > Not to my knowledge. It would be nice... Another option would be to use Direvent, which supports this and more, or maybe =E2=80=98inotifywatch=E2=80=99 from inotify-tools though it seems = to be quite similar to fswatch feature-wise. WDYT? Ludo=E2=80=99.