Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 17 Oct 2009 12:46:37 -0400
From:      "Mikhail T." <mi+thun@aldan.algebra.com>
To:        stable@FreeBSD.org
Subject:   Can close-ing a pipe trigger a SIGPIPE?
Message-ID:  <4AD9F4ED.2050002@aldan.algebra.com>

next in thread | raw e-mail | index | archive | help
Hello!

I'm investigating a problem caused by (what seems like a spurious)
SIGPIPE. The program creates a child process using pipe, exchanges a few
messages with the child (via write and read) and closes the pipe.

Some times -- in about 60% of the cases -- this causes a SIGPIPE to be
delivered to the parent...

Now, it is quite possible for the child to have already exited by the
time the parent closes its end of the pipe -- but why should that cause
a SIGPIPE, unless the parent tries to write something to the widowed
pipe, which it does not?

>From pipe(2):

     A pipe that has had an end closed is considered widowed.  Writing
on such
     a pipe causes the writing process to receive a SIGPIPE signal.

There is no other mention of SIGPIPE in that manual page...

I set SIGPIPE on ignore around the pipe-closing as a work-around, but I
think, this is a bug...

The thing is part of TclX' self-test (test signal-3.0) -- and it was not
dying from SIGPIPE before the FreeBSD-7.x, as far as I can remember...
It still seems to be fine on Linux...

Have there been any changes in this area in FreeBSD? Thanks!

    -mi




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4AD9F4ED.2050002>