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 1n9YnF-0003QQ-RW for pgsql-hackers@arkaria.postgresql.org; Mon, 17 Jan 2022 20:39:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n9YnE-0005xX-MQ for pgsql-hackers@arkaria.postgresql.org; Mon, 17 Jan 2022 20:39:56 +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 1n9YnE-0005xO-DE for pgsql-hackers@lists.postgresql.org; Mon, 17 Jan 2022 20:39:56 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n9YnC-0002gM-3E for pgsql-hackers@postgresql.org; Mon, 17 Jan 2022 20:39:55 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 20HKdetP144979; Mon, 17 Jan 2022 15:39:40 -0500 From: Tom Lane To: Jelte Fennema cc: Andres Freund , Fujii Masao , Zhihong Yu , "pgsql-hackers@postgresql.org" Subject: Re: [EXTERNAL] Re: PQcancel does not use tcp_user_timeout, connect_timeout and keepalive settings In-reply-to: References: <1473763.1636578406@sss.pgh.pa.us> <20220105184225.5xfekapzg5o3uq7a@alap3.anarazel.de> <794237.1641408889@sss.pgh.pa.us> <2912315.1641943641@sss.pgh.pa.us> <2918809.1641947968@sss.pgh.pa.us> <2937814.1641960929@sss.pgh.pa.us> Comments: In-reply-to Jelte Fennema message dated "Wed, 12 Jan 2022 16:11:26 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <144977.1642451980.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 17 Jan 2022 15:39:40 -0500 Message-ID: <144978.1642451980@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Jelte Fennema writes: > Thanks for all the cleanup and adding of windows support. To me it now l= ooks good to merge. I was about to commit this when I started to wonder if it actually does anything useful. In particular, I read in the Linux tcp(7) man page TCP_USER_TIMEOUT (since Linux 2.6.37) ... This option can be set during any state of a TCP connection,= but is effective only during the synchronized states of a connec= tion (ESTABLISHED, FIN-WAIT-1, FIN-WAIT-2, CLOSE-WAIT, CLOSING, = and LAST-ACK). ISTM that the case we care about is where the server fails to respond to the TCP connection request. If it does so, it seems pretty unlikely that it wouldn't then eat the small amount of data we're going to send. While the keepalive options aren't so explicitly documented, I'd bet that they too don't have any effect until the connection is known established. So I'm unconvinced that setting these values really has much effect to make PQcancel more robust (or more accurately, make it fail faster). I would like to know what scenarios you tested to convince you that this is worth doing. regards, tom lane