From: | Mark Wong <markw(at)osdl(dot)org> |
---|---|
To: | Manfred Spraul <manfred(at)colorfullife(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org, osdldbt-general(at)lists(dot)sourceforge(dot)net |
Subject: | Re: OSDL DBT-2 w/ PostgreSQL 7.3.4 and 7.4beta5 |
Date: | 2003-11-01 19:19:55 |
Message-ID: | 20031101111955.D2457@osdlab.pdx.osdl.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Sat, Nov 01, 2003 at 07:27:01PM +0100, Manfred Spraul wrote:
> Tom Lane wrote:
>
> >Manfred Spraul <manfred(at)colorfullife(dot)com> writes:
> >
> >
> >>Is that really necessary?
> >>
> >>
> >
> >Unfortunately, yes. libpq can't change the global setting of SIGPIPE
> >without breaking the surrounding application, but we don't want to crash
> >the app if the server connection has disappeared, either. So we have to
> >set the SIGPIPE handler and then restore it around every send().
> >
> >
> Ok. Ahm. No, wait. libpq is multi-threaded, right?
>
> signal handlers are a process property, not a thread property - that
> code is broken for multi-threaded apps.
> At least that's how I understand the opengroup man page, and a quick
> google confirmed that:
> http://groups.google.de/groups?selm=353662BF.9D70F63A%40brighttiger.com
>
> I haven't found a reliable thread-safe approach yet:
> My first idea was block with pthread_sigmask, after send check if
> pending with sigpending, and then delete with sigwait, and restore
> blocked state. But that breaks if SIGPIPE is blocked and a signal is
> already pending: there is no way to remove our additional SIGPIPE. I
> don't see how we can avoid destroying the realtime signal info.
>
> Mark: Is your dbt2 testapp multithreaded? I don't see the signal
> functions near the top in the profiles on the osdl website.
Yeah, my dbt2 applications are multithreaded.
Mark
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2003-11-01 19:20:46 | Avoiding SIGPIPE (was Re: OSDL DBT-2 w/ PostgreSQL 7.3.4 and 7.4beta5) |
Previous Message | Mark Wong | 2003-11-01 19:16:52 | Re: OSDL DBT-2 w/ PostgreSQL 7.3.4 and 7.4beta5 |