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 1r3dRZ-004rHD-Aa for pgsql-hackers@arkaria.postgresql.org; Thu, 16 Nov 2023 14:34:09 +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 1r3dRX-007IdJ-DN for pgsql-hackers@arkaria.postgresql.org; Thu, 16 Nov 2023 14:34:07 +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.94.2) (envelope-from ) id 1r3dRW-007Id8-Tp for pgsql-hackers@lists.postgresql.org; Thu, 16 Nov 2023 14:34:06 +0000 Received: from meesny.iki.fi ([2001:67c:2b0:1c1::201]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r3dRT-005s3W-Hf for pgsql-hackers@postgresql.org; Thu, 16 Nov 2023 14:34:05 +0000 Received: from [172.21.97.0] (unknown [90.160.41.100]) (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 meesny.iki.fi (Postfix) with ESMTPSA id 4SWMwg6SynzyT6; Thu, 16 Nov 2023 16:33:52 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1700145236; 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=hpB1qBLIa/j7ZCgoyZJjuLBxzv004PQdnIW3AWqaSIk=; b=G1G8gmA4gNOiwA1Cg9cBABIyLicAFxb5yS+cTsU3THRtjUY0F54iITSu57XqVc71vo5cfn 7u35UijVYjA0XTBj8/hSp9QwoWfBPgaqTgojgYpgDi3U806srEV+ul5M4AWKmV4TZeWW/V yEpBV9UvZsHJRTtqYRkPii7dwuRBfDo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1700145236; 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=hpB1qBLIa/j7ZCgoyZJjuLBxzv004PQdnIW3AWqaSIk=; b=EoIUcZs+tAaOPZrZjYgmfOfhvk5wjiooU4RJKYNBta2DG9UqvP0LI9VeGHVHv0D7LurBF0 EDzcX1PT8Wi3jbdPtihkwv0EKMSSf0CESlmrVRDzUWlxBuaPcyM9E31dJsotBhLYR2N4ut lVjlM8tufCMOH9jLqTdbWCXMWH5IpN4= ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=hlinnaka smtp.mailfrom=hlinnaka@iki.fi ARC-Seal: i=1; s=meesny; d=iki.fi; t=1700145236; a=rsa-sha256; cv=none; b=ebvNK3trfGntIzbXqjtLkB2F9XpZ117VXwL6ibJdelBsqMYfD64uUzVUyN5DI2i/+ZuQDL p9dVjZLLClbKQAGwWk0VNlIEFsR7G196+/O79w4ER3+4llvkp1Uy51iZYP8xfahpVt8D0B dbx9PEVGb0coaT7R6NtWUU+BCvqLxMY= Message-ID: <5e28b89f-0033-4e42-8184-b71b731c1aa2@iki.fi> Date: Thu, 16 Nov 2023 15:33:52 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: psql not responding to SIGINT upon db reconnection Content-Language: en-US To: Tristan Partin Cc: Tom Lane , pgsql-hackers@postgresql.org, Shlok Kyal References: <1588058.1690220636@sss.pgh.pa.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 06/11/2023 19:16, Tristan Partin wrote: >>> That sounds like a much better solution. Attached you will find a v4 >>> that implements your suggestion. Please let me know if there is >>> something that I missed. I can confirm that the patch works. This patch is missing a select(). It will busy loop until the connection is established or cancelled. Shouldn't we also clear CancelRequested after we have cancelled the attempt? Otherwise, any subsequent attempts will immediately fail too. Should we use 'cancel_pressed' here rather than CancelRequested? To be honest, I don't understand the difference, so that's a genuine question. There was an attempt at unifying them in the past but it was reverted in commit 5d43c3c54d. -- Heikki Linnakangas Neon (https://neon.tech)