Re: Avoiding SIGPIPE (was Re: OSDL DBT-2 w/ PostgreSQL - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Avoiding SIGPIPE (was Re: OSDL DBT-2 w/ PostgreSQL
Date
Msg-id 5377.1067814405@sss.pgh.pa.us
Whole thread Raw
In response to Re: Avoiding SIGPIPE (was Re: OSDL DBT-2 w/ PostgreSQL  (Manfred Spraul <manfred@colorfullife.com>)
Responses Re: Avoiding SIGPIPE (was Re: OSDL DBT-2 w/ PostgreSQL  (Manfred Spraul <manfred@colorfullife.com>)
List pgsql-hackers
Manfred Spraul <manfred@colorfullife.com> writes:
> If I understand libpq sources correctly, the first packets are send 
> during connection setup - PQsigpipeOK(PGconn *) would be too late.
> That's why I added "sigpipe=caller" as a new flag for PQconnectdb.

That's definitely a problem, but "sigpipe=caller" is one of the very
worst aspects of your proposal.  In many apps the connectinfo string is
passed in more-or-less-directly from user input.  But having the user
fool with sigpipe handling would be disastrous --- either the app is
coded to handle sigpipe properly for itself, or it isn't.  If we're
going to make a hook that allows the app to tell libpq how to handle
sigpipe, then we have to make it feed in the information in some way
other than via the connectinfo string.

It strikes me that sigpipe handling will be a global affair in any
particular application --- it's unlikely that it would be correct for
some PG connections and wrong for others.  So one possibility is to make
the control variable be global (static) and thus it could be set before
creating the first PGconn.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: PlayStation 2 problems
Next
From: Hannu Krosing
Date:
Subject: Re: Experimental patch for inter-page delay in VACUUM