Re: Review: Extra Daemons / bgworker - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Review: Extra Daemons / bgworker
Date
Msg-id 20121205222502.GY27424@awork2.anarazel.de
Whole thread Raw
In response to Re: Review: Extra Daemons / bgworker  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: Review: Extra Daemons / bgworker  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
On 2012-12-05 18:42:42 -0300, Alvaro Herrera wrote:
> >    <para>
> >     <structfield>bgw_sighup</structfield> and <structfield>bgw_sigterm</> are
> >     pointers to functions that will be installed as signal handlers for the new
> > -   process.
> > +   process. XXX: Can they be NULL?
> >    </para>
>
> Hm.  The code doesn't check, so what happens is probably a bug anyhow.
> I don't know whether sigaction crashes in this case; its manpage doesn't
> say.  I guess the right thing to do is have RegisterBackgroundWorker
> check for a NULL sighandler, and set it to something standard if so (say
> SIG_IGN for SIGHUP and maybe quickdie() or similar for SIGTERM).

Afair a NULL sigaction is used to query the current handler. Which
indirectly might lead to problems due to the wrong handler being called.

Setting up SIG_IGN and quickdie in that case seems to be sensible.

Greetings,

Andres Freund

--Andres Freund                       http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Review: Extra Daemons / bgworker
Next
From: Dimitri Fontaine
Date:
Subject: Re: Dumping an Extension's Script