Re: do we EXEC_BACKEND on Mac OS X? - Mailing list pgsql-hackers

From Martijn van Oosterhout
Subject Re: do we EXEC_BACKEND on Mac OS X?
Date
Msg-id 20121003215159.GB24334@svana.org
Whole thread Raw
In response to Re: do we EXEC_BACKEND on Mac OS X?  (Bruce Momjian <bruce@momjian.us>)
Responses Re: do we EXEC_BACKEND on Mac OS X?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Wed, Oct 03, 2012 at 01:57:47PM -0400, Bruce Momjian wrote:
> On Wed, Oct  3, 2012 at 01:53:28PM -0400, Tom Lane wrote:
> > Bruce Momjian <bruce@momjian.us> writes:
> > > Yes, but those framework libraries are typically supposed to prevent
> > > such problems from being seen by applications calling them.
> >
> > How exactly would a library prevent such problems?  In particular,
> > let's see a proposal for how libpq might make it look like a fork
> > was transparent for an open connection.
>
> I guess that is impossible.

Well, not quite impossible. A simple solution would be to use
pthread_atfork() to register a handler that puts the socket into an
invalid state in either the parent or the child.

http://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_atfork.html

Ofcourse, the backward compatabilty issues prevent us doing that, but
it's *possible*.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> He who writes carelessly confesses thereby at the very outset that he does
> not attach much importance to his own thoughts.  -- Arthur Schopenhauer

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Support for REINDEX CONCURRENTLY
Next
From: Andres Freund
Date:
Subject: Re: Support for REINDEX CONCURRENTLY