Re: Avoiding SIGPIPE (was Re: OSDL DBT-2 w/ PostgreSQL

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Manfred Spraul <manfred(at)colorfullife(dot)com>
Cc: AgentM <agentm(at)webopticon(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Avoiding SIGPIPE (was Re: OSDL DBT-2 w/ PostgreSQL
Date: 2003-11-02 23:06:45
Message-ID: 5377.1067814405@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Manfred Spraul <manfred(at)colorfullife(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2003-11-02 23:25:07 Re: PlayStation 2 problems
Previous Message Hannu Krosing 2003-11-02 22:51:24 Re: Experimental patch for inter-page delay in VACUUM