Re: Should we improve "PID XXXX is not a PostgreSQL server process" warning for pg_terminate_backend(<<postmaster_pid>>)?
torikoshia <torikoshia@oss.nttdata.com>
From: torikoshia <torikoshia@oss.nttdata.com>
To: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2021-03-15T05:53:31Z
Lists: pgsql-hackers
On 2021-03-07 19:16, Bharath Rupireddy wrote: > On Fri, Feb 5, 2021 at 5:15 PM Bharath Rupireddy > <bharath.rupireddyforpostgres@gmail.com> wrote: >> >> pg_terminate_backend and pg_cancel_backend with postmaster PID produce >> "PID XXXX is not a PostgresSQL server process" warning [1], which >> basically implies that the postmaster is not a PostgreSQL process at >> all. This is a bit misleading because the postmaster is the parent of >> all PostgreSQL processes. Should we improve the warning message if the >> given PID is postmasters' PID? +1. I felt it was a bit confusing when reviewing a thread[1]. >> >> If yes, how about a generic message for both of the functions - >> "signalling postmaster process is not allowed" or "cannot signal >> postmaster process" or some other better suggestion? >> >> [1] 2471176 ---> is postmaster PID. >> postgres=# select pg_terminate_backend(2471176); >> WARNING: PID 2471176 is not a PostgreSQL server process >> pg_terminate_backend >> ---------------------- >> f >> (1 row) >> postgres=# select pg_cancel_backend(2471176); >> WARNING: PID 2471176 is not a PostgreSQL server process >> pg_cancel_backend >> ------------------- >> f >> (1 row) > > I'm attaching a small patch that emits a warning "signalling > postmaster with PID %d is not allowed" for postmaster and "signalling > PostgreSQL server process with PID %d is not allowed" for auxiliary > processes such as checkpointer, background writer, walwriter. > > However, for stats collector and sys logger processes, we still get > "PID XXXXX is not a PostgreSQL server process" warning because they > don't have PGPROC entries(??). So BackendPidGetProc and > AuxiliaryPidGetProc will not help and even pg_stat_activity is not > having these processes' pid. I also ran into the same problem while creating a patch in [2]. I'm now wondering if changing the message to something like "PID XXXX is not a PostgreSQL backend process". "backend process' is now defined as "Process of an instance which acts on behalf of a client session and handles its requests." in Appendix. [1] https://www.postgresql.org/message-id/CALDaNm3ZzmFS-%3Dr7oDUzj7y7BgQv%2BN06Kqyft6C3xZDoKnk_6w%40mail.gmail.com [2] https://www.postgresql.org/message-id/0271f440ac77f2a4180e0e56ebd944d1%40oss.nttdata.com Regards, -- Atsushi Torikoshi NTT DATA CORPORATION
Commits
-
Improve warning message in pg_signal_backend()
- 7fa945b857cc 15.0 landed