| From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Add errdetail() with PID and UID about source of termination sig |
| Date: | 2026-04-07 14:35:18 |
| Message-ID: | E1wA7WP-003PSa-2y@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Add errdetail() with PID and UID about source of termination signal.
When a backend is terminated via pg_terminate_backend() or an external
SIGTERM, the error message now includes the sender's PID and UID as
errdetail, making it easier to identify the source of unexpected
terminations in multi-user environments.
On platforms that support SA_SIGINFO (Linux, FreeBSD, and most modern
Unix systems), the signal handler captures si_pid and si_uid from the
siginfo_t structure. On platforms without SA_SIGINFO, the detail is
simply omitted.
Author: Jakub Wartak <jakub(dot)wartak(at)enterprisedb(dot)com>
Reviewed-by: Andrew Dunstan <andrew(at)dunslane(dot)net>
Reviewed-by: Chao Li <1356863904(at)qq(dot)com>
Discussion: https://postgr.es/m/CAKZiRmyrOWovZSdixpLd3PGMQXuQL_zw2Ght5XhHCkQ1uDsxjw@mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/55890a919454a2165031a04b175ca92e3ed70e69
Modified Files
--------------
configure | 42 +++++++++++++++++++++++++++++++++++++++
configure.ac | 18 +++++++++++++++++
meson.build | 4 ++++
src/backend/replication/syncrep.c | 14 ++++++++++++-
src/backend/tcop/postgres.c | 34 ++++++++++++++++++++++++-------
src/backend/utils/init/globals.c | 2 ++
src/bin/psql/t/001_basic.pl | 7 +++----
src/include/miscadmin.h | 2 ++
src/include/pg_config.h.in | 3 +++
src/port/pqsignal.c | 35 +++++++++++++++++++++++++++++---
10 files changed, 146 insertions(+), 15 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Heikki Linnakangas | 2026-04-07 14:38:31 | pgsql: Fix harmless leftover in _hash_kill_items() |
| Previous Message | Robert Haas | 2026-04-07 14:16:40 | pgsql: pg_stash_advice: Allow stashed advice to be persisted to disk. |