Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fkdDF-0002tC-TJ for pgsql-general@arkaria.postgresql.org; Tue, 31 Jul 2018 22:33:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fkdDD-0001GF-Lx for pgsql-general@arkaria.postgresql.org; Tue, 31 Jul 2018 22:33:51 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fkdDD-0001G7-AP for pgsql-general@lists.postgresql.org; Tue, 31 Jul 2018 22:33:51 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fkdDA-0002w7-UL for pgsql-general@postgresql.org; Tue, 31 Jul 2018 22:33:50 +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 w6VMXji7013818; Tue, 31 Jul 2018 18:33:45 -0400 From: Tom Lane To: =?iso-8859-9?B?RXJ0YW4gS/zn/Gtv8Gx1?= cc: pgsql-general@postgresql.org Subject: Re: How to prevent "no wait lock" after a connection drop In-reply-to: <000201d4291d$436e75d0$ca4b6170$@1nar.com.tr> References: <000201d4291d$436e75d0$ca4b6170$@1nar.com.tr> Comments: In-reply-to =?iso-8859-9?B?RXJ0YW4gS/zn/Gtv8Gx1?= message dated "Wed, 01 Aug 2018 01:24:35 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <13816.1533076424.1@sss.pgh.pa.us> Date: Tue, 31 Jul 2018 18:33:45 -0400 Message-ID: <13817.1533076425@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk =?iso-8859-9?B?RXJ0YW4gS/zn/Gtv8Gx1?= writes: > What I observe during my tests is that if I intentionally drop internet > connection during any stage of data transfer (that is mostly while inserting > to tables) application gives error and stop. For next sync operation (which > runs every 5 mins) gets "no wait lock" error and exit without doing > anything. That lock stage roughly stays for 1-2 hours or more. This probably corresponds to the TCP timeout needed for the server's kernel to decide the connection is lost; until then, the backend session will just sit there waiting for more data, and it'll be holding whatever locks it had too. You could adjust the server's tcp_keepalives_xxx settings to make it notice the connection drop more quickly. regards, tom lane