Re: BUG #16817: kill process cause postmaster hang

From: Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com>
To: bchen90 <bchen90(at)163(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #16817: kill process cause postmaster hang
Date: 2021-01-25 01:29:52
Message-ID: CAKU4AWoLy-n3cryVpC6ZCcoMXm3V_BmxLgZEbFay3r8GjDe-CA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, Jan 25, 2021 at 9:01 AM bchen90 <bchen90(at)163(dot)com> wrote:

> Hi, tom
>
> Thanks for you reply, and can you elaborate "SIGKILL-after-5-seconds
> logic"?
>
>
> regards, chenbo
>

82233ce7ea42d6ba519aaec63008aff49da6c7af should be the commit Tom was
talking about.

commit 82233ce7ea42d6ba519aaec63008aff49da6c7af
Author: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Date: Fri Jun 28 17:20:53 2013 -0400

Send SIGKILL to children if they don't die quickly in immediate shutdown

On immediate shutdown, or during a restart-after-crash sequence,
postmaster used to send SIGQUIT (and then abandon ship if shutdown); but
this is not a good strategy if backends don't die because of that
signal. (This might happen, for example, if a backend gets tangled
trying to malloc() due to gettext(), as in an example illustrated by
MauMau.) This causes problems when later trying to restart the server,
because some processes are still attached to the shared memory segment.

Instead of just abandoning such backends to their fates, we now have
postmaster hang around for a little while longer, send a SIGKILL after
some reasonable waiting period, and then exit. This makes immediate
shutdown more reliable.

There is disagreement on whether it's best for postmaster to exit after
sending SIGKILL, or to stick around until all children have reported
death. If this controversy is resolved differently than what this patch
implements, it's an easy change to make.

Bug reported by MauMau in message
20DAEA8949EC4E2289C6E8E58560DEC0(at)maumau

MauMau and Álvaro Herrera

--
Best Regards
Andy Fan (https://www.aliyun.com/)

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2021-01-25 01:35:01 Re: BUG #16817: kill process cause postmaster hang
Previous Message bchen90 2021-01-25 01:01:04 Re: BUG #16817: kill process cause postmaster hang