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 1eyN6E-0000aE-NL for pgsql-general@arkaria.postgresql.org; Tue, 20 Mar 2018 19:39:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1eyN6D-0001bL-72 for pgsql-general@arkaria.postgresql.org; Tue, 20 Mar 2018 19:39:09 +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 1eyN6C-0001bC-Sj for pgsql-general@lists.postgresql.org; Tue, 20 Mar 2018 19:39:09 +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 1eyN6A-0006xc-9a for pgsql-general@lists.postgresql.org; Tue, 20 Mar 2018 19:39:07 +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 w2KJcumF030298; Tue, 20 Mar 2018 15:38:56 -0400 From: Tom Lane To: Adrian Klaver cc: =?UTF-8?Q?Albrecht_Dre=c3=9f?= , pgsql-general@lists.postgresql.org Subject: Re: FDW Foreign Table Access: strange LOG message In-reply-to: <4a4ae274-4860-da54-cc31-09749beb6ed8@aklaver.com> References: <3DPLMQIC.YU6IFMLY.3PLOWL6W@FQT5M7HS.IFBAANAE.A7GUPCPM> <4a4ae274-4860-da54-cc31-09749beb6ed8@aklaver.com> Comments: In-reply-to Adrian Klaver message dated "Tue, 20 Mar 2018 12:21:37 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <30296.1521574736.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Tue, 20 Mar 2018 15:38:56 -0400 Message-ID: <30297.1521574736@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Adrian Klaver writes: > On 03/20/2018 11:52 AM, Albrecht Dreß wrote: >> I use Postgres 10.3 on a Debian Stretch system with foreign tables, and >> noticed strange LOG messages when accessing them. >> [time stamp/pid] user@my_db LOG:  could not receive data from client: >> Connection reset by peer > My suspicion is it has to do with this: > postgres_fdw establishes a connection to a foreign server during the > first query that uses a foreign table associated with the foreign > server. This connection is kept and re-used for subsequent queries in > the same session. Perhaps. It's not entirely clear if these complaints are about the original user session or the sub-session opened by postgres_fdw. (Albrecht, if you're not sure either, enabling log_connections and log_disconnections might make it clearer.) I don't see any such log messages when testing postgres_fdw here, which is odd; why are my results different? If these are about the FDW connections, maybe the answer is that postgres_fdw ought to establish a backend-exit callback in which it can shut down its connections gracefully. If it's doing that now, I sure don't see where. regards, tom lane