Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TaX4l-00017m-5K for pgsql-bugs@postgresql.org; Mon, 19 Nov 2012 19:32:11 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TaX4j-000691-Rk for pgsql-bugs@postgresql.org; Mon, 19 Nov 2012 19:32:10 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id qAJJW7Vk010254; Mon, 19 Nov 2012 14:32:07 -0500 (EST) From: Tom Lane To: haribabu.kommi@huawei.com cc: pgsql-bugs@postgresql.org Subject: Re: BUG #7643: Issuing a shutdown request while server startup leads to server hang In-reply-to: References: Comments: In-reply-to haribabu.kommi@huawei.com message dated "Thu, 08 Nov 2012 18:15:02 +0000" Date: Mon, 19 Nov 2012 14:32:07 -0500 Message-ID: <10253.1353353527@sss.pgh.pa.us> X-Pg-Spam-Score: -2.3 (--) X-Archive-Number: 201211/147 X-Sequence-Number: 34705 haribabu.kommi@huawei.com writes: > Problem Reproduction: > 1. Add recovery.conf to the database directory. > 2. Start the server > 3. Issue the shutdown request > and the shutdown request timing should be such that below server logs should > print. > Log: > ./postgres -D data -p 3335 > LOG: database system was shut down in recovery at 2012-11-08 19:42:42 IST > LOG: entering standby mode > LOG: received fast shutdown request > LOG: consistent recovery state reached at 0/17D0700 > LOG: record with zero length at 0/17D0700 > Problem reproduced in 9.3 head. After further investigation, I can't reproduce this and I don't believe your patch fixes it. What happens when I try this is * postmaster gets SIGINT, sends SIGTERM to startup process * startup process exits with exit(1) * postmaster sees that as a startup crash and exits, per the first test in reaper() So the log trace I'm getting looks like LOG: received fast shutdown request LOG: startup process (PID 9772) exited with exit code 1 LOG: aborting startup due to startup process failure Now, transitioning to PM_WAIT_BACKENDS state earlier, as your patch proposes, might make the log look a bit nicer because the logic in reaper() wouldn't think the exit was a "crash". But it's not going to have anything to do with whether the startup process exits on the signal or not. What seems to have happened for you is that the startup process ignored the SIGTERM signal, but it's not at all obvious why. We're going to need more details about how to reproduce this. I speculate it might have something to do with the specific restore_command you're using. regards, tom lane