Re: SIGPIPE handling

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Manfred Spraul <manfred(at)colorfullife(dot)com>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: SIGPIPE handling
Date: 2003-11-16 18:00:55
Message-ID: 200311161800.hAGI0t710877@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > Is running the rest of the
> > application with SIGPIPE <= SIG_IGN a problem?
>
> That is NOT an acceptable thing for a library to do.

Yes, I was afraid of that. Here's another idea. If the signal handler
is SIG_DFL, we install our own signal handler for SIGPIPE, and set/clear a
global variable before/after we send(). When our signal handler is
called, we check to see if our global variable is set, and we either
ignore or exit(). Can we do that safely? Seems it only fails when they
register a signal handler after establishing a database connection.

How would this work in a threaded app --- not too well, I think.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2003-11-16 18:03:19 Re: SIGPIPE handling
Previous Message Tom Lane 2003-11-16 17:53:07 Re: SIGPIPE handling