Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ge2fA-0002kM-5P for pgsql-hackers@arkaria.postgresql.org; Mon, 31 Dec 2018 18:51:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ge2f7-0000bj-IM for pgsql-hackers@arkaria.postgresql.org; Mon, 31 Dec 2018 18:51:41 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ge2f7-0000Xd-9e for pgsql-hackers@lists.postgresql.org; Mon, 31 Dec 2018 18:51:41 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ge2f1-0007ZA-0F for pgsql-hackers@postgresql.org; Mon, 31 Dec 2018 18:51:40 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id wBVIpVwr019455; Mon, 31 Dec 2018 13:51:31 -0500 From: Tom Lane To: Noah Misch cc: pgsql-hackers@postgresql.org Subject: Re: pg_regress: promptly detect failed postmaster startup In-reply-to: <20181231172922.GA199150@gust.leadboat.com> References: <20181231172922.GA199150@gust.leadboat.com> Comments: In-reply-to Noah Misch message dated "Mon, 31 Dec 2018 12:29:22 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <19453.1546282291.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 31 Dec 2018 13:51:31 -0500 Message-ID: <19454.1546282291@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Noah Misch writes: > When "make check TEMP_CONFIG=3D<(echo break_me=3Don)" spawns a postmaste= r that > fails startup, we detect that with "pg_regress: postmaster did not respo= nd > within 60 seconds". pg_regress has a kill(postmaster_pid, 0) intended t= o > detect this case faster. Since kill(ZOMBIE-PID, 0) succeeds[1], that te= st is > ineffective. Ooops. > The fix, attached, is to instead test waitpid(), like pg_ctl's > wait_for_postmaster() does. +1. This leaves postmaster_pid as a dangling pointer, but since we just exit immediately, that seems fine. (If we continued, and arrived at the "kill(postmaster_pid, SIGKILL)" below, it would not be fine.) regards, tom lane