Re: on_exit_reset fails to clear DSM-related exit actions - Mailing list pgsql-hackers

From Peter LaDow
Subject Re: on_exit_reset fails to clear DSM-related exit actions
Date
Msg-id CAN8Q1EdGHeH_5w_4LL=Ls5T=7GLQtBjv362badDzu3dT7N30pg@mail.gmail.com
Whole thread Raw
In response to Re: on_exit_reset fails to clear DSM-related exit actions  (Andres Freund <andres@2ndquadrant.com>)
List pgsql-hackers
On Fri, Mar 7, 2014 at 12:17 PM, Andres Freund <andres@2ndquadrant.com> wrote:
> Man. The point is that that the library code is carefully written to not
> use exit() but _exit() after a fork failure, that's it.

I understand your point.  I understand that in the case of the
postmaster we don't want to invoke behavior that can cause problems by
calling exit(). But how does this jive with Tom's point (on the bug
list) about other 3rd party libraries perhaps registering atexit
handlers?

If the convention is that only fork/exec/_exit is permissible after a
fork (what about on_exit_reset?), then third party libraries also need
to be aware of that convention and not depend on their atexit handlers
being called.

And I'm not advocating a certain solution.  I'm only trying to clarify
what the solution is so that we "comply" with the convention.  We
don't want to break posgres or any other "well behaved" third party
libraries.  I don't know the internals of postgres (hence original bug
report and this thread), so I of course defer to you and the other
experts here.  So, in our case we call on_exit_reset() after the fork
in the child, and then from there on only use fork, exec, or _exit, as
you mention above.

Pete



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: on_exit_reset fails to clear DSM-related exit actions
Next
From: Peter LaDow
Date:
Subject: Re: on_exit_reset fails to clear DSM-related exit actions