Re: 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: Chao Li <li.evan.chao@gmail.com>
Cc: Andrew Dunstan <andrew@dunslane.net>, Tom Lane <tgl@sss.pgh.pa.us>, Andres Freund <andres@anarazel.de>, Jim Jones <jim.jones@uni-muenster.de>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-04-23T10:20:18Z
Lists: pgsql-hackers
On Thu, Apr 23, 2026 at 11:28 AM Chao Li <li.evan.chao@gmail.com> wrote: Hi Chao > > I just got a suspicion about this feature. The repro is very simple: let a normal user connect to the server, then run pg_ctl stop, and from psql you get: > ``` > evantest=> select 1; > FATAL: terminating connection due to administrator command > DETAIL: Signal sent by PID 17523, UID 501. > server closed the connection unexpectedly > This probably means the server terminated abnormally > before or while processing the request. > The connection to the server was lost. Attempting reset: Failed. > The connection to the server was lost. Attempting reset: Failed. > !?> > ``` > > Do we really need to show the DETAIL message with the PID and UID to an ordinary client? Is there any concern about leaking the UID in a shared production deployment? > > If this is confirmed an issue, I made a simple fix by using errdetail_log() to only emit the detail message to server log. Please the attached diff file. +1, I think logging just to file is even better than sending it to the client(s) and it also solves the potential security risk (if any). -J.
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