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 1nbEw3-0007aq-2q for pgsql-hackers@arkaria.postgresql.org; Mon, 04 Apr 2022 05:07:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nbEw1-0002ke-O8 for pgsql-hackers@arkaria.postgresql.org; Mon, 04 Apr 2022 05:07:25 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nbEw1-0002kV-EY for pgsql-hackers@lists.postgresql.org; Mon, 04 Apr 2022 05:07:25 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nbEvz-0002Iq-Fj for pgsql-hackers@lists.postgresql.org; Mon, 04 Apr 2022 05:07:25 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 582C65C00C3; Mon, 4 Apr 2022 01:07:22 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 04 Apr 2022 01:07:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm1; bh=EI3ikTgOTj7cXWljRU9/LcgNbeWb4+m+AKGZSP 71KY0=; b=nFyA3rQDjG1xmh7zd1lug09R9OJzeJ2gU2O2FB+Dtk6un4pzlTAfIM +7gQ4IPCjvSPw8q34pvGxt9xXbwlgKOHOTJYD3sKhnz5AcJRf5uAwDVit7uHc2yM lYhEidcXnKi0My9G2c1sfOHmHRnhTRuVnUBaE2NYGdyulrYc5gbAfUzM3Bq5Bpsm 0tUjTH60SyCv94JWt4PWADg2T7wdx3vCtvRAtZBZk+sT1IOanav+a/Ynbq8gcLCA KAnHHRw1QvGv5JuEC800wSVe8hbfJ2Cgp9sjuxNwcN/c14Nou0vgCtG4Rs4UjvMY eL2Ydir5v/i6WU6Ph8SeIKn8SJ1LjcaQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=EI3ikTgOTj7cXWljR U9/LcgNbeWb4+m+AKGZSP71KY0=; b=gjVWbmmg+arLoC6Eob1cVbWoyEX/HESZn HTG0ebb3w3URfZFlFEu5AD/qwMKxm/JJDCTwxAixtKmL5VNlKO5ALvsHSPdi95GJ jRBZPS8jrEXhhkPGsfPxfw16Cg1kf+Ys4jQrZf/jKAyWXvWanmY4nMgn4wiLN7bi sR/Xn78lSdseZCP4jPWBeHPYcAUxuMycMVATE8D20aDWd1UApMooG4gdKhekL2oE iZPD2hto56luiXtUVxV9qv5TQ/oNmJmuf3hq86Fw6r91LtuPVrObMN/FUe9wHCNP VfBLH70vshiH02/Dp5TQvVXx+IhUnzC5lySXVHPIjSPZplP4QedmA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudejuddgledvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvuffkfhggtggujgesthdtre dttddtvdenucfhrhhomheptehnughrvghsucfhrhgvuhhnugcuoegrnhgurhgvshesrghn rghrrgiivghlrdguvgeqnecuggftrfgrthhtvghrnhepudekhfekleeugeevteehleffff ejgeelueduleeffeeutdelffeujeffhfeuffdunecuvehluhhsthgvrhfuihiivgeptden ucfrrghrrghmpehmrghilhhfrhhomheprghnughrvghssegrnhgrrhgriigvlhdruggv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 4 Apr 2022 01:07:22 -0400 (EDT) Date: Sun, 3 Apr 2022 22:07:21 -0700 From: Andres Freund To: Tom Lane Cc: pgsql-hackers@lists.postgresql.org Subject: Re: Race condition in server-crash testing Message-ID: <20220404050721.sktsuearncwjo6hr@alap3.anarazel.de> References: <1801850.1649047827@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1801850.1649047827@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2022-04-04 00:50:27 -0400, Tom Lane wrote: > My pet dinosaur gaur just failed [1] in > src/test/recovery/t/022_crash_temp_files.pl, which does this: > > ----- > my $ret = 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? Maybe we can use pump_until() with the psql that's not getting killed? With a non-matching regex? That'd only return once the backend was killed by postmaster, afaics? Greetings, Andres Freund