Thread: the postgres process is not killed when the postmaster is killed

the postgres process is not killed when the postmaster is killed

From
范国腾
Date:

Hi,

 

Start a psql client to connect the postgres.  Now we have the postmaster process and the postgres process as below:

postgres  2184     1  0 02:59 ?        00:00:00 /opt/HighGo/db/bin/postgres

postgres  2268  2184  0 04:08 ?        00:00:00 postgres: postgres highgo [local] idle

 

then run the “kill -9 2184” to kill the postmaster, all of the subprocess are killed except the postgres (PID 2268).

 

I could reproduce this issue every time.

 

If the process 2268 is still alive, pg_ctl start and pg_ctl stop will fail.

 

Is it a bug? What should I configure if I want all of the subprocess are killed?

 

Thanks

Steven

Re: the postgres process is not killed when the postmaster is killed

From
Michael Paquier
Date:
On Thu, May 10, 2018 at 08:34:46AM +0000, 范国腾 wrote:
> If the process 2268 is still alive, pg_ctl start and pg_ctl stop will fail.
>
> Is it a bug? What should I configure if I want all of the subprocess are killed?

That's not a bug.  On SIGKILL the postmaster does not send down the
message to its subprocesses.  Note as well that shared memory is not
released as well, so you may need to kill any extra orphan process
remaining alive after the postmaster is down, so that's not a
recommended way to stop the instance.
--
Michael

Attachment