Re: Archiver not exiting upon crash

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Cc: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Archiver not exiting upon crash
Date: 2012-05-23 20:45:09
Message-ID: 11658.1337805909@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jeff Janes <jeff(dot)janes(at)gmail(dot)com> writes:
> On Wed, May 23, 2012 at 1:10 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> On my machine, man system(3) saith:
>>
>> system() ignores the SIGINT and SIGQUIT signals, and blocks the
>> SIGCHLD signal, while waiting for the command to terminate. If this
>> might cause the application to miss a signal that would have killed
>> it, the application should examine the return value from system() and
>> take whatever action is appropriate to the application if the command
>> terminated due to receipt of a signal.

> But what happens if the SIGQUIT is blocked before the system(3) is
> invoked? Does the ignore take precedence over the block, or does the
> block take precedence over the ignore, and so the signal is still
> waiting once the block is reversed after the system(3) is over? I
> could write a test program to see, but that wouldn't be very good
> evidence of the portability.

AFAICT from the POSIX spec for system(3), that would be a bug in
system(). You are supposed to be able to tell from the return value
whether a signal happened. Note that the signals are only supposed to
be ignored while waiting for the command to terminate; therefore, if
a signal does get ignored in the parent process, it should be delivered
to the child, and so we should see its effects in the child's return
code.

Of course, if you are using an archive_command that might itself ignore
SIGQUIT, perhaps that's where the issue is.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2012-05-23 20:55:36 Re: Changing the concept of a DATABASE
Previous Message Jeff Janes 2012-05-23 20:34:16 Re: Archiver not exiting upon crash