From owner-freebsd-net Wed Mar 19 1:31:48 2003 Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AA21037B401 for ; Wed, 19 Mar 2003 01:31:46 -0800 (PST) Received: from gandalf.online.bg (gandalf.online.bg [217.75.128.9]) by mx1.FreeBSD.org (Postfix) with SMTP id A7A0943F3F for ; Wed, 19 Mar 2003 01:31:44 -0800 (PST) (envelope-from roam@ringlet.net) Received: (qmail 7685 invoked from network); 19 Mar 2003 09:27:06 -0000 Received: from office.sbnd.net (HELO straylight.ringlet.net) (217.75.140.130) by gandalf.online.bg with SMTP; 19 Mar 2003 09:27:06 -0000 Received: (qmail 26878 invoked by uid 1000); 19 Mar 2003 09:30:02 -0000 Date: Wed, 19 Mar 2003 11:30:02 +0200 From: Peter Pentchev To: net@FreeBSD.org Cc: Tristan Goode Subject: write(2) SIGPIPE on a closed socket? Message-ID: <20030319093002.GT468@straylight.oblivion.bg> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="7fwXp2o0gOrkU5lS" Content-Disposition: inline User-Agent: Mutt/1.5.3i Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org --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