unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Mark H Weaver <mhw@netris.org>
To: Alex Vong <alexvong1995@gmail.com>
Cc: 29826@debbugs.gnu.org
Subject: bug#29826: nondeterministic Broken pipe
Date: Sun, 24 Dec 2017 17:11:48 -0500	[thread overview]
Message-ID: <87d133lqsb.fsf@netris.org> (raw)
In-Reply-To: <874lohdwhb.fsf@gmail.com> (Alex Vong's message of "Sun, 24 Dec 2017 04:23:44 +0800")

Alex Vong <alexvong1995@gmail.com> writes:

> I get the following error when running ``guix --version | head -n 1''. I
> can get similar after replacing ``--version'' with ``--help''. Also, the
> error is nondeterministic. Any idea?

Attempts to write to a pipe that has already been closed on the other
end results in EPIPE.  From the write(2) man page:

  EPIPE fd is connected to a pipe or socket whose reading end is closed.
        When this happens the writing process will also receive a
        SIGPIPE signal.  (Thus, the write return value is seen only if
        the program catches, blocks or ignores this signal.)

In this case, there's a race condition.  The result depends on whether
"head -n 1" closes its end of the pipe before or after "guix --version"
is finished writing all of its output.  If "head -n 1" closes the pipe
first, then "guix --version" will receive EPIPE while attempting to
write to it.

What normally happens is that the sending process receives SIGPIPE,
which simply causes it to exit prematurely without ever receiving this
error.  However, since Guix arranges to ignore SIGPIPE in
'initialize-guix' in guix/ui.scm, we receive EPIPE.

That's what's happening here.  I'll need to think on how best to fix it.

     Regards,
       Mark

  parent reply	other threads:[~2017-12-24 22:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-23 20:23 bug#29826: nondeterministic Broken pipe Alex Vong
2017-12-23 20:48 ` Andreas Enge
2017-12-24  8:37   ` Alex Vong
2017-12-24 22:11 ` Mark H Weaver [this message]
2017-12-25 14:02   ` Alex Vong
2017-12-31 10:11     ` Ludovic Courtès
2018-01-02 12:07       ` Alex Vong
2018-01-02 19:04       ` Mark H Weaver
2018-01-02 22:17         ` Ludovic Courtès
2018-02-14 12:21 ` Oleg Pykhalov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d133lqsb.fsf@netris.org \
    --to=mhw@netris.org \
    --cc=29826@debbugs.gnu.org \
    --cc=alexvong1995@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).