Re: Add errdetail() with PID and UID about source of termination signal - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Add errdetail() with PID and UID about source of termination signal
Date
Msg-id j7gm4f7bx7hprsc6j4tl47nd5r2vfv5aqevco76rsdawvkwfnd@nsbig7xqlqj5
Whole thread
In response to Re: Add errdetail() with PID and UID about source of termination signal  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: Add errdetail() with PID and UID about source of termination signal
List pgsql-hackers
Hi,

On 2026-04-07 12:49:19 -0400, Andrew Dunstan wrote:
> On 2026-04-07 Tu 10:55 AM, Andres Freund wrote:
> > 
> > This seems completely wrong from a layering POV.  The wrapper has no business
> > whatsoever to know that how SIGTERM is interpreted and thus no business
> > setting variables like ProcDieSenderPid.
> > 
> > Pretty sure have some sigterm handlers that shouldn't set ProcDieSenderPid.
> > 
> > 
> > A more correct answer here would be to forward information about the sender of
> > a signal to the signal handlers and let them interpret the information if
> > available.
> > 
> 
> OK, fair points. Does the attached meet your concerns?

I think the extra data should be forwarded as arguments to the "real" (not
wrapper) handler, not as globals.  You can have signal handlers interrupt each
others on some platforms, which means that if you're not careful, you could
end up reading the values from the wrong signal.

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: EXPLAIN: showing ReadStream / prefetch stats
Next
From: Lukas Fittl
Date:
Subject: Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc?