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 1nXWGi-00039G-78 for pgsql-hackers@arkaria.postgresql.org; Thu, 24 Mar 2022 22:49:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nXWGg-0007si-Iw for pgsql-hackers@arkaria.postgresql.org; Thu, 24 Mar 2022 22:49:22 +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 1nXWGe-0007sI-GJ for pgsql-hackers@lists.postgresql.org; Thu, 24 Mar 2022 22:49:22 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nXWGX-0001lU-55 for pgsql-hackers@lists.postgresql.org; Thu, 24 Mar 2022 22:49:19 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id E4B5E5C00FE; Thu, 24 Mar 2022 18:49:11 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Thu, 24 Mar 2022 18:49:11 -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=VfqOHMBT/o5IB/FKAo+ZIpMO0udu65HaI8JPNF dxr1w=; b=Z996Hg4BQx7/GpIiTD42BU7SpVl3rnwdzO2Wg/zGUY5Q72Jsp4vSVz bUKYD6NccM/SL8t0MQsGABAmsJZ0GSSIU01LG+l2Ew7pcvy7ReXIBiPb8x0yy/4H tgLU0ln33fL6Sh6sF85/o1Bkot5j8dRqRwEICUCzE0mjoF4pyI4EkeOQJFHVd8iK D4BQH1Of2Yn511jHqPFEgmuWPEZJNRslhsTIpBlWU/KNIoPLd8XN8ZldHcJMB/37 AeYHwLDxOQ6SSATke8nGL6Z1pMKqZEGamYnW/OB+C3agELuffVwP/vYnk2GW9vDw rD+CuNOWCTZoB3H3GWQwz01qBDc3s0Zw== 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=VfqOHMBT/o5IB/FKA o+ZIpMO0udu65HaI8JPNFdxr1w=; b=Ri2ZsEhWK6kelhMJPgZTWt2bN2KEb2+69 hIVvXWJK2NJcGy7/nusLK5uOwFD4sqmMAkNTvcYyHNP523UAmms9bS11o4zDzZYR bBDJJgmair1LATiXhCgQV00ln3FQE8mUSuF4ytozz3hrCfBm74mZKAwcNkZYLEj0 lKyRY/oXC2pszDP22lmFn1uE4USfXg5eIqbMSeKCiU5KHyfSfK2T6rAN2mBM+db7 jAERFTCON/EpeTeurbDmMF/G3dBepilvBQM6eDiBIj7NIcu1HZ3Yag8lAMAnI5mO unJameZkJrgZtI2mCI/6zbP/5UBGR7nTAkUIZewWwjFiDDUuXw60Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudegledgudeifecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvuffkfhggtggujgesthdtredttddtvdenucfhrhhomheptehnughr vghsucfhrhgvuhhnugcuoegrnhgurhgvshesrghnrghrrgiivghlrdguvgeqnecuggftrf grthhtvghrnhepudekhfekleeugeevteehleffffejgeelueduleeffeeutdelffeujeff hfeuffdunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh eprghnughrvghssegrnhgrrhgriigvlhdruggv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 24 Mar 2022 18:49:11 -0400 (EDT) Date: Thu, 24 Mar 2022 15:49:09 -0700 From: Andres Freund To: Tom Lane Cc: Jacob Champion , "Jelte.Fennema@microsoft.com" , pgsql-hackers@lists.postgresql.org Subject: Re: Add non-blocking version of PQcancel Message-ID: <20220324224909.4tnubqv2owmfoyoc@alap3.anarazel.de> References: <20220113004411.3tdgiqdmmo4musb5@alap3.anarazel.de> <3150365.1648158113@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3150365.1648158113@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2022-03-24 17:41:53 -0400, Tom Lane wrote: > I kind of feel that this patch is going in the wrong direction. > I do see the need for a version of PQcancel that can encrypt the > transmitted cancel request (and yes, that should work on the backend > side; see recursion in ProcessStartupPacket). I have not seen > requests for a non-blocking version, and this doesn't surprise me. > I feel that the whole non-blocking aspect of libpq probably belongs > to another era when people didn't trust threads. That's not a whole lot of fun if you think of cases like postgres_fdw (or citus as in Jelte's case), which run inside the backend. Even with just a single postgres_fdw, we don't really want to end up in an uninterruptible PQcancel() that doesn't even react to pg_terminate_backend(). Even if using threads weren't an issue, I don't really buy the premise - most networking code has moved *away* from using dedicated threads for each connection. It just doesn't scale. Leaving PQcancel aside, we use the non-blocking libpq stuff widely ourselves. I think walreceiver, isolationtester, pgbench etc would be *much* harder to get working equally well if there was just blocking calls. If anything, we're getting to the point where purely blocking functionality shouldn't be added anymore. Greetings, Andres Freund