Robert Haas <robertmhaas@gmail.com> writes:
> On Sat, Jan 25, 2014 at 5:04 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Yeah. If Robert's diagnosis is correct, and it sounds pretty plausible,
>> then this is really just one instance of a bug that's probably pretty
>> widespread in our signal handlers. Somebody needs to go through 'em
>> all and look for touches of shared memory.
> I haven't made a comprehensive study of every signal handler we have,
> [ but here's how to fix procsignal_sigusr1_handler ]
I've trawled all the remaining signal handlers (or at least everything
declared with SIGNAL_ARGS, which hopefully is all of them). I find
the following bugs:
1. A couple of signal handlers doif (MyWalSnd) SetLatch(&MyWalSnd->latch);
which is fine as far as it goes, but the shutdown sequence in WalSndKill
has exactly the same bug you just fixed in ProcKill: it needs to clear
MyWalSnd before disowning the latch, not after.
2. WalRcvSigUsr1Handler and worker_spi_sighup fail to preserve errno.
Will fix, but the latter bug is a tad disappointing considering that
the coding rule about saving errno in signal handlers has been there
for a *long* time.
regards, tom lane