Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ieh5w-0003SN-BP for pgsql-general@arkaria.postgresql.org; Tue, 10 Dec 2019 15:06:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ieh5u-0003d6-UW for pgsql-general@arkaria.postgresql.org; Tue, 10 Dec 2019 15:06:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ieh5u-0003af-JS for pgsql-general@lists.postgresql.org; Tue, 10 Dec 2019 15:06:34 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ieh5r-00080x-1X for pgsql-general@lists.postgresql.org; Tue, 10 Dec 2019 15:06:34 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id xBAF6RZS004782; Tue, 10 Dec 2019 10:06:27 -0500 From: Tom Lane To: =?utf-8?B?0J7Qu9C10LMg0KHQsNC80L7QudC70L7Qsg==?= cc: "pgsql-generallists.postgresql.org" Subject: Re: tcp keep alive don't work when the backend is busy In-reply-to: <3F592B64-264F-4E95-B555-7E7C9E8F57B8@ya.ru> References: <3F592B64-264F-4E95-B555-7E7C9E8F57B8@ya.ru> Comments: In-reply-to =?utf-8?B?0J7Qu9C10LMg0KHQsNC80L7QudC70L7Qsg==?= message dated "Tue, 10 Dec 2019 15:53:31 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4780.1575990387.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 10 Dec 2019 10:06:27 -0500 Message-ID: <4781.1575990387@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk =3D?utf-8?B?0J7Qu9C10LMg0KHQsNC80L7QudC70L7Qsg=3D=3D?=3D wr= ites: > According to the documentation = > https://www.postgresql.org/docs/12/runtime-config-connection.html > A backend must check connection to the client by tcp_keepalive messages.= (Config option tcp_keepalives_idle). > But this is don't work if the backend is busy. You're reading something into the documentation that isn't there. The TCP keepalive mechanism is something that the OS does, independently of backend processing. The backend isn't going to notice loss of client connection until it tries to read or write on the connection. If it were free to improve this, we might do so. But it would be very much not free. regards, tom lane