Add errdetail() with PID and UID about source of termination signal

From: Jakub Wartak <jakub(dot)wartak(at)enterprisedb(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Add errdetail() with PID and UID about source of termination signal
Date: 2026-02-18 07:32:25
Message-ID: CAKZiRmyrOWovZSdixpLd3PGMQXuQL_zw2Ght5XhHCkQ1uDsxjw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Attachment Content-Type Size
v1-0001-Add-errdetail-with-PID-and-UID-about-source-of-te.patch text/x-patch 10.6 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2026-02-18 07:39:08 Re: Skipping schema changes in publication
Previous Message Peter Smith 2026-02-18 07:27:50 DOCS - System Applications 'datadir' parameter