Re: Allow signal handlers to optionally use SA_SIGINFO information? - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Allow signal handlers to optionally use SA_SIGINFO information?
Date
Msg-id 20141110180546.GE28007@alap3.anarazel.de
Whole thread Raw
In response to Re: Allow signal handlers to optionally use SA_SIGINFO information?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 2014-11-10 09:50:17 -0500, Tom Lane wrote:
> Andres Freund <andres@2ndquadrant.com> writes:
> > Posix provides information about the source of the signal when using
> > SA_SIGINFO style handlers via si_code/si_pid. That information has been
> > available for a *long* while
> > (c.f. http://pubs.opengroup.org/onlinepubs/7908799/xsh/signal.h.html).
> 
> That does not mean that it exists on all the platforms we support;
> Windows in particular is likely to be an issue.

Given that we essentially use a named pipe to transport signals, it
shouldn't be too hard if we decide we need it.

> I concur with Heikki that you're probably solving this at the wrong
> end anyway, since the next question you'll be asking is *why* did
> process X send that signal.

I agree that that's the most useful thing for any specific situation
fully under our control. But generally I'd have more than once found it
useful to have the sender of a signal available - even if it's just
during debugging.  I also previously would have liked to know where
INT/TERM are coming from - having the senders pid can be useful to
diagnose.

If we add it, it's surely nothing we ever are going to rely on - as you
say, there's portability issues. But printing it optionallY in a few
place at appropriate debug levels + having it available in signal
handlers during debugging sounds useful enough anyway to me.

Greetings,

Andres Freund

-- Andres Freund                       http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services



pgsql-hackers by date:

Previous
From: Jim Nasby
Date:
Subject: Re: Proposal: Log inability to lock pages during vacuum
Next
From: Andres Freund
Date:
Subject: Re: Proposal: Log inability to lock pages during vacuum