From owner-freebsd-questions Mon Mar 24 18:36:11 2003 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E45AE37B401 for ; Mon, 24 Mar 2003 18:36:06 -0800 (PST) Received: from discovery.gangofone.com (adsl-63-197-69-57.dsl.snfc21.pacbell.net [63.197.69.57]) by mx1.FreeBSD.org (Postfix) with ESMTP id 05BC143F3F for ; Mon, 24 Mar 2003 18:36:06 -0800 (PST) (envelope-from dave@jetcafe.org) Received: from hokkshideh2.jetcafe.org (hokkshideh2.jetcafe.org [64.239.180.8]) by discovery.gangofone.com (8.12.8/8.12.8) with ESMTP id h2P2Z0Lm024021 for ; Mon, 24 Mar 2003 18:35:00 -0800 (PST) X-Hokkshideh-Envelope-To: freebsd-questions@FreeBSD.ORG Received: from hokkshideh2.jetcafe.org (localhost [127.0.0.1]) by hokkshideh2.jetcafe.org (8.12.8/8.12.8) with ESMTP id h2P2Zuuq056175; Mon, 24 Mar 2003 18:35:56 -0800 (PST) Message-Id: <200303250235.h2P2Zuuq056175@hokkshideh2.jetcafe.org> X-Mailer: exmh version 2.5 07/13/2001 with nmh-1.0.4 To: Dan Nelson Cc: freebsd-questions@FreeBSD.ORG Subject: Re: SIGPIPE and threaded servers Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 24 Mar 2003 18:35:56 -0800 From: Dave Hayes X-Spam-Status: No, hits=-9.7 required=5.0 tests=EMAIL_ATTRIBUTION,QUOTED_EMAIL_TEXT autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Dan Nelson writes: > In the last episode (Mar 23), Dave Hayes said: >> I have a relatively simple threaded TCP server that services high >> volumes of requests. Currently it appears to randomly crash receiving >> a SIGPIPE. >> >> Attempts to ignore SIGPIPE via the sigaction() semantic only prevent >> me from sending the signal with "kill" to test whether or not SIGPIPE >> is actually ignored. =/ > Then it's being ignored and your job is done :) Heh, I have to remember to be excrutiatingly explicit when I ask these questions. =) >> What is going on here? > From the signal manpage: > Name Default Action Description > ---- -------------- ----------- > SIGPIPE terminate process write on a pipe with no reader > It's doing just what it is supposed to. But it's not doing what I want it to do. I don't want my process with all it's threads to terminate if I write on a pipe with no reader. I want the write() to return EPIPE so I can handle it there. It's not doing that currently. Installing a signal handler doesn't work to get it to do that. Ignoring the signal doesn't work. I've used both signal() and sigaction() semantics to no avail. What do I have to do so that SIGPIPE does not terminate my process? ------ Dave Hayes - Consultant - Altadena CA, USA - dave@jetcafe.org >>> The opinions expressed above are entirely my own <<< If you want to shoot for the moon, aim for the sun To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message