Re: [GENERAL] Shutting down a warm standby database in 8.2beta3

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stephen Harris <lists(at)spuddy(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [GENERAL] Shutting down a warm standby database in 8.2beta3
Date: 2006-11-18 03:49:39
Message-ID: 24322.1163821779@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Stephen Harris <lists(at)spuddy(dot)org> writes:
> However, it seems the signal wasn't sent at all.

Now that I think about it, the behavior of system() is predicated on the
assumption that SIGINT and SIGQUIT originate with the tty driver and are
broadcast to all members of the session's process group --- so the
called command will get them too, and there's no need for system() to
do anything except wait to see whether the called command dies or traps
the signal.

This does not apply to signals originated by the postmaster --- it
doesn't even know that the child process is doing a system(), much less
have any way to signal the grandchild. Ugh.

Reimplementing system() seems pretty ugly, but maybe we have no choice.
It strikes me that system() has a race condition as defined anyway,
because if a signal arrives between blocking the handler and issuing the
fork(), it'll disappear into the ether; and the same at the end of the
routine.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stephen Harris 2006-11-18 03:52:15 Re: [HACKERS] Shutting down a warm standby database in 8.2beta3
Previous Message Euler Taveira de Oliveira 2006-11-18 03:33:29 Re: [GENERAL] Allowing SYSDATE to Work

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Harris 2006-11-18 03:52:15 Re: [HACKERS] Shutting down a warm standby database in 8.2beta3
Previous Message Euler Taveira de Oliveira 2006-11-18 03:40:09 Re: Brazilian FAQ update