pgsql: Add errdetail() with PID and UID about source of termination sig - Mailing list pgsql-committers

From Andrew Dunstan
Subject pgsql: Add errdetail() with PID and UID about source of termination sig
Date
Msg-id E1wA7WP-003PSa-2y@gemulon.postgresql.org
Whole thread
List 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.wartak@enterprisedb.com>
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>
Reviewed-by: Chao Li <1356863904@qq.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(-)


pgsql-committers by date:

Previous
From: Robert Haas
Date:
Subject: pgsql: pg_stash_advice: Allow stashed advice to be persisted to disk.
Next
From: Heikki Linnakangas
Date:
Subject: pgsql: Fix harmless leftover in _hash_kill_items()