| From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
|---|---|
| To: | Andres Freund <andres(at)anarazel(dot)de>, Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> |
| Cc: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, Jakub Wartak <jakub(dot)wartak(at)enterprisedb(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Add errdetail() with PID and UID about source of termination signal |
| Date: | 2026-04-09 10:59:39 |
| Message-ID: | acd7c8a3-9646-4023-8938-d49eb9c6a3f1@dunslane.net |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 2026-04-08 We 1:01 PM, Andres Freund wrote:
> Hi,
>
> Attached is a very rough first draft for how I think this needs to look like.
>
> Basically, SIGNAL_INFO always will pass both the signal number and extended
> information along to the signal handler. The extended information is a
> postgres specific struct. If the platform can't provide the extended
> information, the values are instead set to some default value indicating that
> the information is not known.
>
> With that die() (and also StatementCancelHandler, ...) can just set whatever
> globals it wants, without pqsignal.c needing to know about it.
>
> It also allows us to extend the amount of information in the future. E.g. I'd
> like to log the reason for a segfault (could e.g. be an OOM kill or an umapped
> region) to stderr.
>
> The annoying thing about it is needing to change nearly all the existing
> references to SIG_IGN/SIG_DFL, to avoid warnings due to mismatched types.
I agree that's annoying. The only way around it I found was via some
casting to/from void* that I suspect you would find a cure worse than
the disease.
I reworked your patch slightly. This version fixes the translatability
issue you raised earlier, makes the TAP test from the original commit
more robust, and tries to resolve your XXX issue by moving the
assignment of ProcDieSenderPid/Uid inside the "if
(!proc_exit_inprogress)" block.
cheers
andrew
--
Andrew Dunstan
EDB:https://www.enterprisedb.com
| Attachment | Content-Type | Size |
|---|---|---|
| 0001-Rework-signal-sender-errdetail-to-pass-info-via-hand.patch | text/x-patch | 34.3 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jim Jones | 2026-04-09 11:07:12 | Re: Additional message in pg_terminate_backend |
| Previous Message | Dagfinn Ilmari Mannsåker | 2026-04-09 10:51:05 | pgcrypto: remove useless px_memset() and BF_ASM |