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.96) (envelope-from ) id 1wgrYv-006Sh3-2D for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Jul 2026 22:13:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wgrYt-003KML-1e for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Jul 2026 22:13:11 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wgrYt-003KMD-0V for pgsql-hackers@lists.postgresql.org; Mon, 06 Jul 2026 22:13:11 +0000 Received: from lahtoruutu.iki.fi ([2a0b:5c81:1c1::37]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wgrYq-00000001uko-3No6 for pgsql-hackers@lists.postgresql.org; Mon, 06 Jul 2026 22:13:10 +0000 Received: from [10.0.2.15] (unknown [130.41.208.2]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hlinnaka) by lahtoruutu.iki.fi (Postfix) with ESMTPSA id 4gvJWt4lj8z49Px6; Tue, 07 Jul 2026 01:12:58 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1783375979; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QBT5yzruLIqCOnBzH2HgHG+P2GU6cltiep8tRwW/+/g=; b=SL0Fz+U86V3kH0VkpP08YUKVwxqfyidLtGRzZjMjJI5r+1+cQhlZ5tY5tdHCdmf6JGf6M9 3LyrnxVvVmw2sQ0fX4Y7unZ00w1eJWsDVUNPRK+Kk/QWF/znJRa2nAV2LoLoKgSCqp4vCU AU0QbP5gmuJWf/FmmrpG/hHUZR27Q7E7hxmrNBksBM+kIRWWr3wfwtkeS/9SyJDhRo5vGy qO/2K//dOo2zCV3VBrggkrEzP/OZftHQD6Eg73iY3Q3GPiOnTh6Z1nflcseRB8yGjjVAH2 vaEahwiYWz951vE4TcW+u5MkKc3Of0ic0u4+SrjcShNTn2xwz/CxlU3FPNUpIg== ARC-Seal: i=1; a=rsa-sha256; d=iki.fi; s=lahtoruutu; cv=none; t=1783375979; b=pgBxkkgBgW7t6pNjqBZeeTk2UxecNE+ppoQy//8TwHbp/2dZFaJkqM+VzBgjGZxlchJP9K DnQe8ZZqJwD6cgyuMPZZcJu7TdpL/o+4N4HT3QLBYxJqy3dCt/n6wrR0bJglNpbk30wvFf ZqbdAa8LhZxAIAxeZfmYk3k4g9Me7jolAcTaI8AEQfFuoNnA6spEJHWTpJMfLiRrv/C3qw 0T4QqFdBqp5f5++sEE775UA7te8+psp9fGdqE4sRM187t56W9bxGsWZM9Ejehha/7ZRIeW dF/4i8mKkBAXKGzRHt150SLAO+kyVbrg+z5JLAUcQb1W7guSgOCNpjm6bl9i+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1783375979; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QBT5yzruLIqCOnBzH2HgHG+P2GU6cltiep8tRwW/+/g=; b=QZxaiSxZqBGtA4zAVPMj0R47SnYQPrd8TJHFfG2NEgeJcshgboibPW7rBR6k9MkUE7ln9g AL2e6G9Ke613Bj8a1FHoLue5RMAcsZewOV0NTlY7p8AB3cCRgYtarFqWVmkoRW4/Sryi2h sRwd0kGqKqheollig8L81yoEzlaBFoLiSej8vD3ynABhbpiKTj10pzJHNndygxknk1V/bD KSHetvucGfsXEg5Eo1ihLLrh2wvf5LPizLajXwoa/IjdcO2iUlQRbhZyKJQxcluWwoA0s9 9Lj+HvxLeL9mYGeLvZ8pqi1XKFc/YrCbDQV7bPvC07eUb3YibST/z2G1bqUWTg== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=hlinnaka smtp.mailfrom=hlinnaka@iki.fi Message-ID: Date: Tue, 7 Jul 2026 01:12:57 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Don't use the deprecated and insecure PQcancel in our frontend tools anymore To: Jelte Fennema-Nio Cc: PostgreSQL Hackers , Alvaro Herrera , Jacob Champion References: <88dfe280-ba29-4943-95b8-63abc9f3f771@iki.fi> <9d7ba3ac-d660-483e-8f68-9096a2464e90@iki.fi> Content-Language: en-US From: Heikki Linnakangas In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 04/07/2026 01:28, Jelte Fennema-Nio wrote: > On Tue, 7 Apr 2026 at 02:18, Heikki Linnakangas wrote: >> The cancel handling in wait_on_slots() in parallel_slot.c is surprising >> in a different way. It already uses async libpq calls and has a select() >> loop, but it still relies on the signal handler to do the cancellation. >> And it arbitrarily PQcancel()s only one of the connections it waits on. > > Addressed this in 0002 This relies on the signal to interrupt select(), but I'm afraid that's not guaranteed on all platforms. Also, there's a race condition if the signal arrives *just* before you call select(). That's what the "self-pipe hack" is for, see comments at waiteventset.c. - Heikki