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 1sI8r8-00DPcM-9E for pgsql-admin@arkaria.postgresql.org; Fri, 14 Jun 2024 15:28:46 +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 1sI8r5-002Y9o-TT for pgsql-admin@arkaria.postgresql.org; Fri, 14 Jun 2024 15:28:44 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sI8r5-002Y9f-I1 for pgsql-admin@lists.postgresql.org; Fri, 14 Jun 2024 15:28:44 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sI8qz-001eXE-V8 for pgsql-admin@postgresql.org; Fri, 14 Jun 2024 15:28:43 +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 45EFSX4B2300379; Fri, 14 Jun 2024 11:28:33 -0400 From: Tom Lane To: Rui DeSousa cc: pgsql-admin Subject: Re: Keepalive In-reply-to: <161042FE-FC86-456B-A8E1-AED38AE01820@icloud.com> References: <161042FE-FC86-456B-A8E1-AED38AE01820@icloud.com> Comments: In-reply-to Rui DeSousa message dated "Fri, 14 Jun 2024 11:22:06 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <2300377.1718378913.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 14 Jun 2024 11:28:33 -0400 Message-ID: <2300378.1718378913@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Rui DeSousa writes: > I have a very long running query that is not being terminated after a ke= ep alive timeout event. The situation is that the client drops from the n= etwork, the servers=E2=80=99 tcp/ip stack drops the connection, and the Po= stgres query continues to run without a network connection. = > The given system is running on Linux and I=E2=80=99m being told this is = expected behavior; however, that is not has not been my experience. My pr= eferred platform to run Postgres on is FreeBSD and in cases like this the = Postgres session is also terminated once the tcp/ip connection is dropped = by the kernel. Really? I would expect the query to keep running until the backend tries to perform some I/O to the client. How quickly that happens would depend a great deal on the details of the query, but not on which OS you're running on. regards, tom lane