Date: Mon, 24 Mar 2003 18:35:56 -0800 From: Dave Hayes <dave@jetcafe.org> To: Dan Nelson <dnelson@allantgroup.com> Cc: freebsd-questions@FreeBSD.ORG Subject: Re: SIGPIPE and threaded servers Message-ID: <200303250235.h2P2Zuuq056175@hokkshideh2.jetcafe.org>
next in thread | raw e-mail | index | archive | help
Dan Nelson <dnelson@allantgroup.com> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200303250235.h2P2Zuuq056175>
