Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Mar 2003 11:30:02 +0200
From:      Peter Pentchev <roam@ringlet.net>
To:        net@FreeBSD.org
Cc:        Tristan Goode <tgoode@iprimus.com.au>
Subject:   write(2) SIGPIPE on a closed socket?
Message-ID:  <20030319093002.GT468@straylight.oblivion.bg>

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

--7fwXp2o0gOrkU5lS
Content-Type: text/plain; charset=windows-1251
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi,

In http://marc.theaimsgroup.com/?l=3Ddjbdns&m=3D104796742521473&w=3D2 and
http://marc.theaimsgroup.com/?l=3Ddjbdns&m=3D104802936220297&w=3D2 Tristan
Goode describes a weird problem on FreeBSD 4.5: a program (DJB's
dnscache) getting a SIGPIPE when attempting to write to an incoming
connection's socket.  Presumably, the client closed the connection in
the meantime, possibly due to a timeout; the funny part is that the
ktrace's show the following sequence of events:

line 320845:		accept() returns fd 170
line 320875-325758:	successive read()'s return data
line 325784:		a successful write() returns the full amount of
			data written
line 325794-328586:	more read()'s
line 328612:		another successful write()
(repeat a few more times, exactly the same pattern)
line 334354:		the last successful write()
line 334364-335002:	more read()'s, all successful
line 335028:		another attempted write()
line 335029:		PSIG SIGPIPE

The question: if the client closed the socket, shouldn't a write(2)
return -1 with errno =3D=3D EPIPE before sending a SIGPIPE?  Does anyone
know anything about problems with writing to closed sockets in FreeBSD
4.5 or such?

A bzipped version of the tracefile is available at
http://people.FreeBSD.org/~roam/dnscache-ktrace.txt.bz2

G'luck,
Peter

--=20
Peter Pentchev	roam@ringlet.net    roam@sbnd.net    roam@FreeBSD.org
PGP key:	http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint	FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553
because I didn't think of a good beginning of it.

--7fwXp2o0gOrkU5lS
Content-Type: application/pgp-signature
Content-Disposition: inline

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

iD8DBQE+eDia7Ri2jRYZRVMRAgtHAKChd4gfAIaqX2vHBzcqohk85v75EwCfeiAX
DvIjje7srzUoSkmNZCEcPqc=
=wcwf
-----END PGP SIGNATURE-----

--7fwXp2o0gOrkU5lS--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




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