From: Noah Misch <noah@leadboat.com>
To: pgsql-hackers@postgresql.org
Subject: pg_regress: promptly detect failed postmaster startup
Date: Mon, 31 Dec 2018 12:29:22 -0500
Message-ID: <20181231172922.GA199150@gust.leadboat.com> (raw)
When "make check TEMP_CONFIG=<(echo break_me=on)" spawns a postmaster that
fails startup, we detect that with "pg_regress: postmaster did not respond
within 60 seconds". pg_regress has a kill(postmaster_pid, 0) intended to
detect this case faster. Since kill(ZOMBIE-PID, 0) succeeds[1], that test is
ineffective. The fix, attached, is to instead test waitpid(), like pg_ctl's
wait_for_postmaster() does.
[1] Search for "zombie" in
http://pubs.opengroup.org/onlinepubs/9699919799/functions/kill.htmlAttachments:pg_regress-dead-postmaster-v1.patch (text/x-diff, 535B) downloaddiff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.cindex 63fe689..2c46941 100644--- a/src/test/regress/pg_regress.c+++ b/src/test/regress/pg_regress.c@@ -2414,7 +2414,7 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc
* Fail immediately if postmaster has exited
*/
#ifndef WIN32
- if (kill(postmaster_pid, 0) != 0)+ if (waitpid(postmaster_pid, NULL, WNOHANG) == postmaster_pid)
#else
if (WaitForSingleObject(postmaster_pid, 0) == WAIT_OBJECT_0)
#endif
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: noah@leadboat.com
Subject: Re: pg_regress: promptly detect failed postmaster startup
In-Reply-To: <20181231172922.GA199150@gust.leadboat.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox