On Sun, Dec 17, 2000 at 10:47:55PM -0500, Tom Lane wrote:
>
> A quick-and-dirty workaround would be to save and restore errno in
> reaper() and the other postmaster signal handlers. It might be
> a better idea in the long run to avoid doing system calls in the
> signal handlers --- but that would take a more substantial rewrite.
>
> I seem to recall previous pghackers discussions in which
> saving/restoring errno looked like a good idea. Not sure why
> it hasn't been done already.
Syscalls in signal handlers open doors for lots of mischief, not least
because it's impractical to test all the combinations of half-run mainline
syscalls with all the other syscalls that may occur in signal handlers.
(select() and wait(), by themselves, get exercised enough, but bugs in
other pairs may be too hard to reproduce ever to be identified.) Maybe
somebody noted that patching errno handling would only close one hole,
and make it less likely the real fix would be done.
That the signal handler got an error on its syscall might be cause for
concern as well.
Sounds like a TODO list item: eliminate syscalls from signal handlers.
Nathan Myers
ncm@zembu.com