Re: Problem with reading startup packet after fork

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Problem with reading startup packet after fork
Date: 2001-06-21 03:28:32
Message-ID: 11892.993094112@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> I think there will be a race condition around the time of a database
> shutdown. After a new child process is created, the system may go into
> shutdown mode. However, there is a window where the child won't know
> this, because the signal is blocked and/or not set up yet.

The child will hold off the signal until it can do something about it.
The postmaster will wait for the child to exit. Where's the problem?

Note the following comment in postgres.c:

/*
* Set up signal handlers and masks.
*
* Note that postmaster blocked all signals before forking child process,
* so there is no race condition whereby we might receive a signal
* before we have set up the handler.
*
* Also note: it's best not to use any signals that are SIG_IGNored in
* the postmaster. If such a signal arrives before we are able to
* change the handler to non-SIG_IGN, it'll get dropped. If
* necessary, make a dummy handler in the postmaster to reserve the
* signal.
*/

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Matthew T. O'Connor 2001-06-21 04:21:31 Re: Re: Universal admin frontend
Previous Message Tom Lane 2001-06-21 03:20:39 Re: Error messages