Skip to content

Commit fbc7f59

Browse files
committed
If test postmaster fails to start within 60 seconds, try to kill -9 it
so that it won't interfere with later trials. Per recent buildfarm experience. Anyone know how to do this on Windows?
1 parent a1dad99 commit fbc7f59

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

src/test/regress/pg_regress.c

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
1212
* Portions Copyright (c) 1994, Regents of the University of California
1313
*
14-
* $PostgreSQL: pgsql/src/test/regress/pg_regress.c,v 1.19 2006/08/01 18:01:36 momjian Exp $
14+
* $PostgreSQL: pgsql/src/test/regress/pg_regress.c,v 1.20 2006/08/13 20:39:07 tgl Exp $
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
@@ -1552,9 +1552,25 @@ main(int argc, char *argv[])
15521552

15531553
pg_usleep(1000000L);
15541554
}
1555-
if (i == 60)
1555+
if (i >= 60)
15561556
{
1557-
fprintf(stderr, _("\n%s: postmaster did not start within 60 seconds\nExamine %s/log/postmaster.log for the reason\n"), progname, outputdir);
1557+
fprintf(stderr, _("\n%s: postmaster did not respond within 60 seconds\nExamine %s/log/postmaster.log for the reason\n"), progname, outputdir);
1558+
1559+
/*
1560+
* If we get here, the postmaster is probably wedged somewhere
1561+
* in startup. Try to kill it ungracefully rather than leaving
1562+
* a stuck postmaster that might interfere with subsequent test
1563+
* attempts.
1564+
*
1565+
* XXX is there a way to do this on Windows?
1566+
*/
1567+
#ifndef WIN32
1568+
if (kill(postmaster_pid, SIGKILL) != 0 &&
1569+
errno != ESRCH)
1570+
fprintf(stderr, _("\n%s: could not kill failed postmaster: %s\n"),
1571+
progname, strerror(errno));
1572+
#endif
1573+
15581574
exit_nicely(2);
15591575
}
15601576

0 commit comments

Comments
 (0)