Re: BUG #7643: Issuing a shutdown request while server startup leads to server hang

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Hari Babu <haribabu(dot)kommi(at)huawei(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #7643: Issuing a shutdown request while server startup leads to server hang
Date: 2012-11-20 21:00:29
Message-ID: 14768.1353445229@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hari Babu <haribabu(dot)kommi(at)huawei(dot)com> writes:
>> We're going to need more details about how to reproduce this.

> The problem occurs only when active server is restarting by just adding a
> recovery.conf file to the data directory.

Well, you can't just put an empty file there, but I eventually managed
to reproduce this with the suggested hack in xlog.c.

I think the key problem is that postmaster.c's sigusr1_handler() is
willing to start new children even after shutdown has been initiated.
I don't see any good reason for it to do that, so I think the
appropriate patch is as attached.

Changing that still leaves us with the postmaster thinking that the
eventual exit(1) of the startup process is a "crash". This is mostly
cosmetic since it still shuts down okay, but we can fix it by reversing
the order of the first two checks in reaper() --- that is, if Shutdown
is set, we should prefer that code path even if we're in PM_STARTUP
state.

I concluded that it probably wasn't a good idea to have the additional
state transition in SIGINT handling. Generally PM_STARTUP means "we're
running the startup process and nothing else", and that's useful state
info that we shouldn't throw away lightly.

regards, tom lane

Attachment Content-Type Size
bug-7643-fix.patch text/x-patch 5.0 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Amit Kapila 2012-11-21 04:51:23 Re: BUG #7676: pgSocketCheck dosen`t return
Previous Message Wes Devauld 2012-11-20 17:59:52 Re: BUG #7685: last_value() not consistent throughout window partition