Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nbEfh-0006p6-Dq for pgsql-hackers@arkaria.postgresql.org; Mon, 04 Apr 2022 04:50:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nbEff-0005SJ-9H for pgsql-hackers@arkaria.postgresql.org; Mon, 04 Apr 2022 04:50:31 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nbEff-0005S7-0H for pgsql-hackers@lists.postgresql.org; Mon, 04 Apr 2022 04:50:31 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nbEfc-0008Rp-F0 for pgsql-hackers@lists.postgresql.org; Mon, 04 Apr 2022 04:50:29 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 2344oRh11801851 for ; Mon, 4 Apr 2022 00:50:27 -0400 From: Tom Lane To: pgsql-hackers@lists.postgresql.org Subject: Race condition in server-crash testing MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1801849.1649047827.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 04 Apr 2022 00:50:27 -0400 Message-ID: <1801850.1649047827@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk My pet dinosaur gaur just failed [1] in src/test/recovery/t/022_crash_temp_files.pl, which does this: ----- my $ret =3D PostgreSQL::Test::Utils::system_log('pg_ctl', 'kill', 'KILL', = $pid); is($ret, 0, 'killed process with KILL'); # Close psql session $killme->finish; $killme2->finish; # Wait till server restarts $node->poll_query_until('postgres', undef, ''); ----- It's hard to be totally sure, but I think what happened is that gaur hit the in-hindsight-obvious race condition in this code: we managed to execute a successful iteration of poll_query_until before the postmaster had noticed its dead child and commenced the restart. The test lines after these are not prepared to see failure-to-connect. It's not obvious to me how to remove this race condition. Thoughts? regards, tom lane [1] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=3Dgaur&dt=3D20= 22-04-03%2021%3A14%3A41