From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Subject: bug#29826: nondeterministic Broken pipe Date: Tue, 02 Jan 2018 23:17:08 +0100 Message-ID: <874lo3ykgr.fsf@gnu.org> References: <874lohdwhb.fsf@gmail.com> <87d133lqsb.fsf@netris.org> <87608uaorx.fsf@gmail.com> <87k1x32on0.fsf@gnu.org> <87inckxetr.fsf@netris.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39103) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eWUsp-0001wD-F5 for bug-guix@gnu.org; Tue, 02 Jan 2018 17:18:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eWUsk-0001Y6-13 for bug-guix@gnu.org; Tue, 02 Jan 2018 17:18:06 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:53113) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eWUsj-0001Xo-TP for bug-guix@gnu.org; Tue, 02 Jan 2018 17:18:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eWUsj-0000oD-Ht for bug-guix@gnu.org; Tue, 02 Jan 2018 17:18:01 -0500 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <87inckxetr.fsf@netris.org> (Mark H. Weaver's message of "Tue, 02 Jan 2018 14:04:16 -0500") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Mark H Weaver Cc: Alex Vong , 29826@debbugs.gnu.org Hello, Mark H Weaver skribis: > ludo@gnu.org (Ludovic Court=C3=A8s) writes: [...] >> Not sure! We specifically ignore EPIPE in cases where it matters, such >> as for the output of =E2=80=98guix package --search=E2=80=99, =E2=80=98g= uix package -A=E2=80=99, etc. >> In other cases, it=E2=80=99s probably an error, so it=E2=80=99s worth re= porting. >> >> WDYT? > > I see from the comment in (guix ui) where SIGPIPE is ignored, the > rationale: > > ;; Ignore SIGPIPE. If the daemon closes the connection, we prefer to be > ;; notified via an EPIPE later. > (sigaction SIGPIPE SIG_IGN) > > Instead of unconditionally ignoring SIGPIPE here in (initialize-guix), > it might be better to ignore SIGPIPE only if we open a connection to the > daemon with the intent of mutating the store, and perhaps in some other > cases where we're mutating information on disk (e.g. switching > generations). In those cases, we have a job to do that should ideally > be completed regardless of whether anyone is still listening to our > STDOUT. > > However, in many other cases, we don't mutate anything on disk, and our > *only* job is printing information to the user, e.g. when showing > version/usage information, the list of available packages, the list of > generations, etc. In those cases, I think it would be better to let > SIGPIPE kill us, because there is no reason to keep the 'guix' process > alive if its output is going nowhere. These are also the cases where > it's most useful to pipe 'guix' output into other commands. > > So, I think we should consider removing (sigaction SIGPIPE SIG_IGN) from > (initialize-guix), and instead putting it in various other selected > places. > > What do you think? Why not. An option would be to move (sigaction SIGPIPE SIG_IGN) to =E2=80=98open-connection=E2=80=99, though that=E2=80=99s not following =E2= =80=9Clibrary design best practices.=E2=80=9D If we do that, can we really remove the =E2=80=98leave-on-EPIPE=E2=80=99 us= es that we have in (guix scripts package) for instance? At first sight they are in =E2=80=98process-query=E2=80=99, which corresponds to operations that don= =E2=80=99t rely on the store, so that should be safe. There are a few other uses of =E2=80=98leave-on-EPIPE=E2=80=99 that happen = while the store is opened (in =E2=80=98guix size=E2=80=99, =E2=80=98guix challenge=E2= =80=99). We=E2=80=99d have to keep these. Thoughts? Ludo=E2=80=99.