Re: libpq and psql not on same page about SIGPIPE - Mailing list pgsql-hackers

From Manfred Spraul
Subject Re: libpq and psql not on same page about SIGPIPE
Date
Msg-id 41AD6A3A.1040004@colorfullife.com
Whole thread Raw
In response to Re: libpq and psql not on same page about SIGPIPE  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
Bruce Momjian wrote:

>Comments?  This seems like our only solution.
>
>  
>
This would be a transparent solution. Another approach would be:
- Use the old 7.3 approach by default. This means perfect backward 
compatibility for single-threaded apps and broken multithreaded apps.
- Add a new PQinitDB(int disableSigpipeHandler) initialization function. 
Document that multithreaded apps must call the function with 
disableSigpipeHandle=1 and handle SIGPIPE for libpq. Perhaps with a 
reference implementation in libpq (i.e. a sigpipeMode with 0 for old 
approach, 1 for do nothing, 2 for install our own handler).

It would prefer that approach:
It means that the multithreaded libpq apps must be updated [are there 
any?], but the solution is simpler and less fragile than calling 4 
signal handling function in a row to selectively block SIGPIPE per-thread.

--   Manfred


pgsql-hackers by date:

Previous
From: Chris Green
Date:
Subject: Re: Adding Reply-To: to Lists configuration ...
Next
From: Antti Salmela
Date:
Subject: Index used incorrectly with regular expressions on 7.4.6