Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 17 Oct 2009 20:27:18 +0300
From:      Kostik Belousov <kostikbel@gmail.com>
To:        "Mikhail T." <mi+thun@aldan.algebra.com>
Cc:        stable@freebsd.org
Subject:   Re: Can close-ing a pipe trigger a SIGPIPE?
Message-ID:  <20091017172718.GJ2160@deviant.kiev.zoral.com.ua>
In-Reply-To: <4AD9F4ED.2050002@aldan.algebra.com>
References:  <4AD9F4ED.2050002@aldan.algebra.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--hcut4fGOf7Kh6EdG
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sat, Oct 17, 2009 at 12:46:37PM -0400, Mikhail T. wrote:
> Hello!
>=20
> 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.
>=20
> Some times -- in about 60% of the cases -- this causes a SIGPIPE to be
> delivered to the parent...
>=20
> 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?
>=20
> >From pipe(2):
>=20
>      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.
>=20
> There is no other mention of SIGPIPE in that manual page...
>=20
> I set SIGPIPE on ignore around the pipe-closing as a work-around, but I
> think, this is a bug...
>=20
> 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...
>=20
> Have there been any changes in this area in FreeBSD? Thanks!

Take ktrace of both parent and child.

--hcut4fGOf7Kh6EdG
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (FreeBSD)

iEYEARECAAYFAkrZ/nUACgkQC3+MBN1Mb4iPyQCgxoW6eL1fGE0xk7qRu0lqu95M
HM8AoOqWj4AgEMscmKywS8CDeI4P6rzd
=dy63
-----END PGP SIGNATURE-----

--hcut4fGOf7Kh6EdG--



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