Add errdetail() with PID and UID about source of termination signal
Jakub Wartak <jakub.wartak@enterprisedb.com>
From: Jakub Wartak <jakub.wartak@enterprisedb.com>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-02-18T07:32:25Z
Lists: pgsql-hackers
Attachments
- v1-0001-Add-errdetail-with-PID-and-UID-about-source-of-te.patch (text/x-patch) patch v1-0001
Hi all, From time to time we have scenario where somebody has some backend killed by some_script_somewhere(TM) in a multi-department company scenario and to me it was always unnecessary time intensive to identify the origin of the signal. eBPF/bpftrace can be used to find the origin, but I think that PG could simply log which PID/UID (e.g. root or pg-user) raised the signal. So Linux has SA_SIGINFO, we could use that to provide mentioned things. As expected, search of course returned that it was discussed earlier here [1] 11 years ago, but there was no patch back then, so attached is an attempt to do just that. No GUC, and yes it only displays it on Linux. I think FreeBSD also has this, but I haven't tried it there (or I haven't tried other OSes without it - proper autoconf/meson sa_sigaction SA_SIGINFO detection is probably missing with proper #ifdefs ), but I would first like to learn if that would be a welcomed feature or not. -J. [1] - https://hackorum.dev/topics/32019
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Only show signal-sender PID/UID detail in server log
- b772f3fcad18 19 (unreleased) landed
-
Make psql DETAIL line test unconditionally optional.
- 446c400fd89b 19 (unreleased) landed
-
Rework signal handler infrastructure to pass sender info as argument.
- 3e2a1496bae6 19 (unreleased) landed
-
Add errdetail() with PID and UID about source of termination signal.
- 55890a919454 19 (unreleased) landed