Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rkTqf-00D1Zz-Jn for pgsql-hackers@arkaria.postgresql.org; Wed, 13 Mar 2024 19:01:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rkTqd-00BAWg-EI for pgsql-hackers@arkaria.postgresql.org; Wed, 13 Mar 2024 19:01:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rkTqc-00BAWX-75 for pgsql-hackers@lists.postgresql.org; Wed, 13 Mar 2024 19:01:07 +0000 Received: from fhigh8-smtp.messagingengine.com ([103.168.172.159]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rkTqX-004M2T-0U for pgsql-hackers@lists.postgresql.org; Wed, 13 Mar 2024 19:01:05 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 67BA91140114; Wed, 13 Mar 2024 15:00:58 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Wed, 13 Mar 2024 15:00:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1710356458; x= 1710442858; bh=zW34hlZBnOlsEP7hiuAvZEEvWwNr/CXP6q7Mni847tg=; b=U 20LdR4bM+4puYeHYgoqE5RoyCnzFzHb43gLG24jpLB8MG36slXOFSC+NsFXizX6d rYlBf29vzr4o7bZnCb/2/jyLRbGfq1w5h5a94cEpqYi/A61fD6AOf4JNNxXVHPCT dJy8tOqTY0FPTmsmpQt3JzmQ8nkfJ1gXJzeKcpNdd4UbA6n638n9N9a1EhqA1RaO yEyUx6LxhI+ZMRAXxxU+0JCfo0qEPXtbEu8U1vaOmu2PrQ93lQZWXvZZ4GVYIbLU coHzClQmqmyCWSRhlSt8aqtAY+SJZo0MUT5LUmEpkYvF58r//zXx6v6c6OdFIHis R2Ww+3UqmRhLOYHbEK1nQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrjeehgdduudelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgr rhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh eqnecuggftrfgrthhtvghrnhepledvkedvueelteefffevjefgfeeuleehjedtieevjeel ffegfeelgedvteekvdetnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomh dpphhoshhtghhrrdgvshenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgr ihhlfhhrohhmpegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 13 Mar 2024 15:00:56 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1710356452; bh=5dpnrob9wEIF1rU7qcPZzg2odsyokwGFfB7ASfrtq9s=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=RomxehUNGydu6BbXmOcIkCUH0+twjxs4A+2PwM03BWYhSg9dM9EuOt99P9+wO736h EsGvemr2x1vpY1iIl50U2mzHp8pBHHAbo8aeZeQ/eXIBcYlAMrHAxpx2t9z6SBx6t+ vh2v0NGgySaS1kNBxtk448elmsqF0Xcidc3Zuk3jM9Q9Y9qhKpTqIAVmYuR+7xmRrP cqHXp1nbFoJrjFoNhSxfvqYxorlVCehCaR5WkyrlEBEwz8BK0uhPyPJnkjP/FJT9Vo 01K10Z/Fr8Mopleyok90pU2VZ1gYPh77ag1s3dADbrHvQywYKitb7y2NNnbrwaQ3YB KWG1cqOOY+tSQ== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id E76FCCD5; Wed, 13 Mar 2024 20:00:52 +0100 (CET) Date: Wed, 13 Mar 2024 20:00:52 +0100 From: Alvaro Herrera To: Jelte Fennema-Nio Cc: Tom Lane , Denis Laxalde , vignesh C , Thomas Munro , Greg Stark , "Gregory Stark (as CFM)" , Jelte Fennema , Daniel Gustafsson , Peter Eisentraut , Andres Freund , Justin Pryzby , Robert Haas , "pgsql-hackers@lists.postgresql.org" Subject: Re: [EXTERNAL] Re: Add non-blocking version of PQcancel Message-ID: <202403131900.6ih7a4dzqefu@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2024-Mar-13, Jelte Fennema-Nio wrote: > I agree it's probably a timing issue. The cancel being received after > the query is done seems very unlikely, since the query takes 180 > seconds (assuming PG_TEST_TIMEOUT_DEFAULT is not lowered for these > animals). I think it's more likely that the cancel request arrives too > early, and thus being ignored because no query is running yet. The > test already had logic to wait until the query backend was in the > "active" state, before sending a cancel to solve that issue. But my > guess is that that somehow isn't enough. > > Sadly I'm having a hard time reliably reproducing this race condition > locally. So it's hard to be sure what is happening here. Attached is a > patch with a wild guess as to what the issue might be (i.e. seeing an > outdated "active" state and thus passing the check even though the > query is not running yet) I tried leaving the original running in my laptop to see if I could reproduce it, but got no hits ... and we didn't get any other failures apart from the three ones already reported ... so it's not terribly high probability. Anyway I pushed your patch now since the theory seems plausible; let's see if we still get the issue to reproduce. If it does, we could make the script more verbose to hunt for further clues. -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ "Here's a general engineering tip: if the non-fun part is too complex for you to figure out, that might indicate the fun part is too ambitious." (John Naylor) https://postgr.es/m/CAFBsxsG4OWHBbSDM%3DsSeXrQGOtkPiOEOuME4yD7Ce41NtaAD9g%40mail.gmail.com