Re: Should we improve "PID XXXX is not a PostgreSQL server process" warning for pg_terminate_backend(<<postmaster_pid>>)?

From: torikoshia <torikoshia(at)oss(dot)nttdata(dot)com>
To: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Should we improve "PID XXXX is not a PostgreSQL server process" warning for pg_terminate_backend(<<postmaster_pid>>)?
Date: 2021-03-17 02:35:45
Message-ID: 151823300177e8cb5f66270a358775b9@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2021-03-16 20:51, Bharath Rupireddy wrote:
> On Mon, Mar 15, 2021 at 11:23 AM torikoshia
> <torikoshia(at)oss(dot)nttdata(dot)com> wrote:
>>
>> On 2021-03-07 19:16, Bharath Rupireddy wrote:
>> > On Fri, Feb 5, 2021 at 5:15 PM Bharath Rupireddy
>> > <bharath(dot)rupireddyforpostgres(at)gmail(dot)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].
>
> Hmmm.
>
>> > 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 have not gone through that thread though. Is there any way we can
> detect those child processes(stats collector, sys logger) that are
> forked by the postmaster from a backend process? Thoughts?

I couldn't find good ways to do that, and thus I'm now wondering
just changing the message.

>> 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.
>
> Yeah, that looks good to me. IIUC, we can just change the message from
> "PID XXXX is not a PostgreSQL server process" to "PID XXXX is not a
> PostgreSQL backend process" and we don't need look for AuxiliaryProcs
> or PostmasterPid.

Changing log messages can affect operations, especially when people
monitor the log message strings, but improving "PID XXXX is not a
PostgreSQL server process" does not seem to cause such problems.

Regards,

--
Atsushi Torikoshi
NTT DATA CORPORATION

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2021-03-17 02:37:44 Re: [HACKERS] logical decoding of two-phase transactions
Previous Message Andres Freund 2021-03-17 02:31:01 Re: Getting better results from valgrind leak tracking