Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1enkXg-00084U-Fh for pgsql-bugs@arkaria.postgresql.org; Mon, 19 Feb 2018 12:27:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1enkXf-0007Qf-2w for pgsql-bugs@arkaria.postgresql.org; Mon, 19 Feb 2018 12:27:35 +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.84_2) (envelope-from ) id 1enkXe-0007QV-Pt for pgsql-bugs@lists.postgresql.org; Mon, 19 Feb 2018 12:27:34 +0000 Received: from lungold.riddles.org.uk ([82.68.208.19]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1enkXb-0006mT-K1 for pgsql-bugs@lists.postgresql.org; Mon, 19 Feb 2018 12:27:33 +0000 Received: from [192.168.127.1] (port=30422 helo=caithnard.riddles.org.uk) by lungold.riddles.org.uk with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.88 (FreeBSD)) (envelope-from ) id 1enkXX-00079V-V0; Mon, 19 Feb 2018 12:27:27 +0000 Received: from [127.0.0.1] (port=25461 helo=caithnard.riddles.org.uk) by caithnard.riddles.org.uk with esmtp (Exim 4.89 (FreeBSD)) (envelope-from ) id 1enkXX-000NLY-8Z; Mon, 19 Feb 2018 12:27:27 +0000 From: Andrew Gierth To: pgsql-bugs@lists.postgresql.org, lars.vonk@gmail.com Subject: Re: BUG #15074: psql client never returns when creating index (long running operation) In-Reply-To: <151902880834.1393.3975169520725435333@wrigleys.postgresql.org> (PG Bug reporting form's message of "Mon, 19 Feb 2018 08:26:48 +0000") Message-ID: <87h8qdp3qr.fsf@news-spur.riddles.org.uk> References: <151902880834.1393.3975169520725435333@wrigleys.postgresql.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (berkeley-unix) Date: Mon, 19 Feb 2018 12:27:26 +0000 MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk >>>>> "PG" == PG Bug reporting form writes: PG> When creating an index on a table containing approx. 100M records PG> the psql client never returns when the index is eventually created PG> on the server. This happens both in a psql client (9.6.6) on mac PG> osx and using the libpq client via the ruby pg gem when using PG> active records migrations. PG> When running the command directly op the postgres database server PG> using the psql client it works as expected. PG> The logs from the server: PG> 2018-02-16 16:11:05 CET:82.161.205.254(59584):REDACTED@REDACTED_DB:[23141]: PG> LOG: duration: 999618.165 ms PG> 2018-02-16 16:11:05 CET:82.161.205.254(59584):REDACTED@REDACTED_DB:[23141]: PG> LOG: could not receive data from client: Connection reset by peer This looks like a network issue; most likely you have a NAT or stateful firewall in between the client and server which is dropping idle connections, with a timeout set shorter than your keepalive interval on either client or server. The server gets "connection reset" because it tried to send the result of the statement, plus the "ready for query" message, and the NAT/firewall sent back a reset because it no longer recognized the connection as valid. The psql client itself continues to wait for input (and will do so until the keepalive timeout is reached if keepalive is enabled, otherwise indefinitely) because the NAT/firewall doesn't typically send any proactive reset messages. -- Andrew (irc:RhodiumToad)