nondeterministic Broken pipe

  • Open
  • quality assurance status badge
Details
3 participants
  • Alex Vong
  • Andreas Enge
  • Mark H Weaver
Owner
unassigned
Submitted by
Alex Vong
Severity
normal
Merged with

Debbugs page

A
A
Alex Vong wrote on 23 Dec 2017 12:23
(address . bug-guix@gnu.org)
874lohdwhb.fsf@gmail.com
Hello,

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?


$ LC_ALL=C guix --version | head -n 1
guix (GNU Guix) 91213c384b62bc422896d39005efa922e4fa75f2
Backtrace:
In ice-9/boot-9.scm:
160: 14 [catch #t #<catch-closure 5628460c6140> ...]
In unknown file:
?: 13 [apply-smob/1 #<catch-closure 5628460c6140>]
In ice-9/boot-9.scm:
66: 12 [call-with-prompt prompt0 ...]
In ice-9/eval.scm:
432: 11 [eval # #]
In ice-9/boot-9.scm:
2404: 10 [save-module-excursion #<procedure 5628460e8900 at ice-9/boot-9.scm:4051:3 ()>]
4056: 9 [#<procedure 5628460e8900 at ice-9/boot-9.scm:4051:3 ()>]
1727: 8 [%start-stack load-stack ...]
1732: 7 [#<procedure 5628460fdb40 ()>]
In unknown file:
?: 6 [primitive-load "/usr/local/bin/guix"]
In guix/ui.scm:
390: 5 [show-version-and-exit "guix"]
In ice-9/format.scm:
1593: 4 [format #t "Copyright ~a 2017 ~a" "(C)" "the Guix authors\n"]
766: 3 [format:format-work "Copyright ~a 2017 ~a" ("(C)" "the Guix authors\n")]
264: 2 [tilde-dispatch]
73: 1 [format:out-obj-padded #f "the Guix authors\n" #f ()]
In unknown file:
?: 0 [display "the Guix authors\n" #<output: file 1>]

ERROR: In procedure display:
ERROR: In procedure scm_flush: Broken pipe
Backtrace:
In ice-9/boot-9.scm:
160: 1 [catch #t #<catch-closure 562846cd3020> ...]
In unknown file:
?: 0 [apply-smob/1 #<catch-closure 562846cd3020>]

ERROR: In procedure apply-smob/1:
ERROR: In procedure scm_flush: Broken pipe


Cheers,
Alex
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEdZDkzSn0Cycogr9IxYq4eRf1Ea4FAlo+u1EACgkQxYq4eRf1
Ea4WFQ//Qs7gaQ4IqFdRINQw7hXfgiFCimU6H0R5wVmY04KKDdvIJCcoQ4uJnZt0
cBriF97WqsTLJnqGWufbHZjdqg5QwkC94PAHGiGOMip8oiYx0LEMEFCyDasJpDBM
BxCInhYn0cc6S1lybm/MqCUg0LIJxsPGnX9omt0JBqyRK+uzR04UXH8D5WEt+ce3
9sJEfW1i4jItohH61O/84UC9s2M6xcwDdK00ccOI124HjY/L5o0Q78o62oKgriyR
I7LDV94SK3SFewv1HfmJp9cv1dcQ9P6PUj3xuvSoilynAqZYL0jRBJjIu0o2TNov
HtiOMn3GuxD1Gydndka9GVaoF7l77zrhekNZK1Yyx0S/ErNDtGrnjSpOcIZOhPN5
m7TWSPgySzQ6zG/rMV11TN0cw5u47ySQvpkAm87FwVjWjGQqkzcAWx4H4xrV8o/e
m+crN/IVsJXOgV44Kd9NRz4zU6qjDyS8bfdlKj5w7U34Lgiqk4r+Z9EkhWD4PWjO
cNftriGtKgRCI2io9yvKrUe+oBt5NmJi05uIq3jp6mR7JqoNRsi87cNYKgaPbG09
PILRGAXvqTD+zVH2L4tHVtfeajmosFZStKHXt6UVtXi9z62IHdIfw4h3CdlUU8tD
RAyFv8H8jDpQJoDV8ZPxyYn9jZuR9N4FTN/dzaqO+2p4UPnVIls=
=VWJk
-----END PGP SIGNATURE-----

A
A
Andreas Enge wrote on 23 Dec 2017 12:48
(name . Alex Vong)(address . alexvong1995@gmail.com)(address . 29826@debbugs.gnu.org)
20171223204828.GA3290@jurong
On Sun, Dec 24, 2017 at 04:23:44AM +0800, Alex Vong wrote:
Toggle quote (3 lines)
> ERROR: In procedure display:
> ERROR: In procedure scm_flush: Broken pipe

Interesting! I get a different error message:

ERROR: In procedure display:
In procedure fport_write: Broken pipe

Andreas
A
A
Alex Vong wrote on 24 Dec 2017 00:37
(name . Andreas Enge)(address . andreas@enge.fr)(address . 29826@debbugs.gnu.org)
87zi68cyhq.fsf@gmail.com
Andreas Enge <andreas@enge.fr> writes:

Toggle quote (11 lines)
> On Sun, Dec 24, 2017 at 04:23:44AM +0800, Alex Vong wrote:
>> ERROR: In procedure display:
>> ERROR: In procedure scm_flush: Broken pipe
>
> Interesting! I get a different error message:
>
> ERROR: In procedure display:
> In procedure fport_write: Broken pipe
>
> Andreas

Hmm... This may due to the fact I am using Guile 2.0 instead of 2.2
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEdZDkzSn0Cycogr9IxYq4eRf1Ea4FAlo/Z2IACgkQxYq4eRf1
Ea5Acg/+ImxYM3S7Gep4IFLhuOolvQeaR+NOjZ5sUcNuYN2LdGID/Bg4ZNcinjyp
4JeCgF5uk0CCOcJhbQlGe+nnvbvjRo0vryIglGNukYi5FUV/N1nzmkehcmaADGin
BHwVSg4PS2wm7U16b/Yy/rmAerbcwngjlU8/+vwqIGijoifroV09cwk0ohoqiNVM
i1D1Td5tkvWQDJsEJJ8tU1KRzGlKwCheUQEjK4bpEgONgg59h9QgBBdac356z8yv
X2EjZ+/Aly+5K4MnHSSqitY1rEukakBRw7qeehhM0FoSmxmbrXFhXi7cqx+fHzGt
URVVw1XKeqGzkY1cyu+6j5BqslvwzkQ6vTkBZ32c0CZTLEuoohHCWaNTLCM2t7K5
q4oFiAVx6WQ6V5X4wLdrrsIDolFOUGzWuEpju2POI526cPeGmnafs1lUP+kzo9z4
7RjMo44YQMdvRs2FGNmKbKpAY+/fBm7sPR0CbDnNB5ZL+JftB2NbU9iVq7Tpmr5/
ek6QOf80knfFKzMCL9/kKjc8TDpYVGPrGZ1Rplvp1zzQYW0j8cyiJ2NdH+29+gH6
N59Wq/Z81x7rJiOxjJvBiPqjMp32MQfLKGVu8FgZqSl99mg0itGW1g57dL3KhNfA
QVnJQspfaHm7bGzagppJGR+r0NTdEqjdwOthSGj24MFIkJsbUew=
=TujI
-----END PGP SIGNATURE-----

M
M
Mark H Weaver wrote on 24 Dec 2017 14:11
(name . Alex Vong)(address . alexvong1995@gmail.com)(address . 29826@debbugs.gnu.org)
87d133lqsb.fsf@netris.org
Alex Vong <alexvong1995@gmail.com> writes:

Toggle quote (4 lines)
> 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
A
A
Alex Vong wrote on 25 Dec 2017 06:02
(name . Mark H Weaver)(address . mhw@netris.org)(address . 29826@debbugs.gnu.org)
87608uaorx.fsf@gmail.com
Mark H Weaver <mhw@netris.org> writes:

Toggle quote (30 lines)
> 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

Nice explaination as always! I forget to mention that I reported a bug
of similar flavour before http://bugs.gnu.org/27017. I agree that
thought is needed to fix all instances of this type of bug.

Cheers,
Alex
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEdZDkzSn0Cycogr9IxYq4eRf1Ea4FAlpBBRMACgkQxYq4eRf1
Ea7WKBAAq2tmAVBLOBX36icO3f8qb+9YsUvhrilqbLCa00uLCyUyN7PLp2vvlwPu
U5Jo7cXw3OgifmqplbIiaVvyhJQwA2Rvlzfyw3Xi05z2NNX7dOOFA0LBLo3+ieE8
EUugVPbIJQJRTj1yFBQq56w+f62Ze95MFhn6efmHqAvCDjP6eG0QNyxq5P/Q8R3A
7p8LACieqz9xYQsKk7PVLDXxsCFiF3RaVB+hOZa6d7aYBCXejvQvBVSkNsJSd6hV
SC7sm7PX96UA6I4mue3jVFV7Wv/HQMYn9uaTFfs8OLI+3nwbOvhvhJrgyGcamuep
WPG9Ghko4RUbm7/AVzwZ2C2I/o5z4wPEaDfmLqhH0NXx3SJu0htMw2as8lys9/LF
JfunT5pmPtZGC8jLMUMz2kf+mJhGsYuhmNsCbC9QXQD8OuzO8XrZuWHt+blmRt8C
uQjUodrqXDFz5ZfqFMuk/MevikR6oxQ7xO0RGYGuqj8Nyju9+Y+V7DHgffG0RVi3
LdvYv5PEyzeS6xbM4gsjKpB+ExDcgWIU+iooNoGA7gZs58vXvqOHvnBtuhU3fY2N
YQgnjLp4NLvqRulDQ7JobxsPfelzqqQ1OZNz/EtJBsl1yGz6kndsUuogtcPblKkD
uyLuj+IeNxy0CnFkVKMEuZgI8v+Kt9tKOXsuuBiFuIBFpH4wOgA=
=DDTi
-----END PGP SIGNATURE-----

?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 29826@patchwise.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 29826
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch