Re: libpq and psql not on same page about SIGPIPE

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>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: libpq and psql not on same page about SIGPIPE
Date: 2004-12-02 16:08:20
Message-ID: 200412021608.iB2G8Ka01914@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom Lane wrote:
> Manfred Spraul <manfred(at)colorfullife(dot)com> writes:
> > Tom Lane wrote:
> >> Not really: it only solves the problem *if you change the application*,
> >> which is IMHO not acceptable.
>
> > No. non-threaded apps do not need to change. The default is the old, 7.3
> > code: change the signal handler around the write calls. Which means that
> > non-threaded apps are guaranteed to work without any changes, regardless
> > of the libpq thread safety setting.
>
> Hmm, so you propose that a thread-enabled library must contain both code
> paths and choose between them on the fly? That seems like the worst of
> all possible worlds --- it's not backwards compatible, it's therefore
> unsafe, it's slow, *and* it'll be #ifdef hell to read.
>
> On a platform that has pthread_sigmask, ISTM we can use that
> unconditionally and it'll work whether the calling app is threaded or
> not. We only fall back to the pqsignal method if we aren't supporting
> threads. There's no need for a runtime test nor for an API change.

Agreed. Manfred, I guess the big question is why not use something that
is automatic like I just applied?

Now that the patch is in, would someone run some threaded performance
tests and see if those pg_*_sigpipe routines are causing any performance
problems.

--
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

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2004-12-02 16:10:10 Re: Please release (was Re: nodeAgg perf tweak)
Previous Message Tom Lane 2004-12-02 15:50:07 Re: libpq and psql not on same page about SIGPIPE

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2004-12-02 18:11:03 Re: [BUGS] solaris non gcc compiler debug options
Previous Message Tom Lane 2004-12-02 15:50:07 Re: libpq and psql not on same page about SIGPIPE