agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Andrew Dunstan <andrew@dunslane.net>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add errdetail() with PID and UID about source of termination sig
Date: Tue, 07 Apr 2026 14:35:18 +0000
Message-ID: <E1wA7WP-003PSa-2y@gemulon.postgresql.org> (raw)

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(-)



Message-ID: <E1wA7WP-003PSa-2y@gemulon.postgresql.org>
Permalink:  ../E1wA7WP-003PSa-2y@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1wA7WP-003PSa-2y@gemulon.postgresql.org

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: andrew@dunslane.net, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Add errdetail() with PID and UID about source of termination sig
  In-Reply-To: <E1wA7WP-003PSa-2y@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox