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 1eyiR0-0003Bi-BR for pgsql-general@arkaria.postgresql.org; Wed, 21 Mar 2018 18:26:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1eyiQz-0006KG-5E for pgsql-general@arkaria.postgresql.org; Wed, 21 Mar 2018 18:26:01 +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_SHA384:256) (Exim 4.89) (envelope-from ) id 1eyiQy-0006K7-TM for pgsql-general@lists.postgresql.org; Wed, 21 Mar 2018 18:26:00 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eyiQv-0004eS-UD for pgsql-general@lists.postgresql.org; Wed, 21 Mar 2018 18:26:00 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 5A01720F20; Wed, 21 Mar 2018 14:25:56 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute6.internal (MEProxy); Wed, 21 Mar 2018 14:25:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; bh=f5meOTsGn6LxbzglOcT05bqoMihWJ mhXdBV7zOSxLJI=; b=Q6i3MBRTxOrO3o6dXw/JjWmnV/IkznX8Gj6P/xGiYacpO tsNEf/ZF3ai/hM+HeuGmxNad1fepxJgXsVdNo/Yw+v+4JwGh+I0POI+s6WLznQnD 6/eewsYPDzB0gMwL75izTD8xFAd2X2ujn0irvwBVzrHrcVKVu67PGFtQnMW/gFIa N18hnwHsJhjy54OlnCXKD4AfI7RnrLyze7nJAz8JHfPZ+4jbOHk9jP/2v7bcCh9y Wq5t1EeN9vxepzF8nWSizdlFso9r1gDSdhtmvZX5byZCE+oDlhDCoP7nSV5CrDFw NDzOBAu/ZJIOMjAv5i4hmESA3J8z3fcPrLSGWJr+w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=f5meOT sGn6LxbzglOcT05bqoMihWJmhXdBV7zOSxLJI=; b=RLj1UXSjrqOaG1CHi3a9cr cxZxua0OxAwyszxXA7vM8SVCRRzVAPkiuqaz7REznwRCThTnCgq+mZ8S+WLf9etb fQpKG7eUe8pJxol8w0/QI8z9eqvKeMSxEDj9VasLQ22yZU5rz4i5hL6toacqTxRw jm1lIjkiS5ZhzJ/ow/wmKq0+A2+B049z5jWL3mQXKZiMvBFRi83bHwDKbez6CfDO UYJTs1JaXuuq2EFDU3brN2ixoINPEESsFLhDSQQcwtjFA2WVlGAQZ68d+lHo7KP8 CqZbIogW66QE3074cFEyKt3Bk6CpeiEh4xKX1K3fwD12L3JQVcbGUtQKych9TaOQ == X-ME-Sender: Received: from ranger.suse (unknown [74.94.73.222]) by mail.messagingengine.com (Postfix) with ESMTPA id B9981240DB; Wed, 21 Mar 2018 14:25:55 -0400 (EDT) Subject: Re: FDW Foreign Table Access: strange LOG message To: =?UTF-8?Q?Albrecht_Dre=c3=9f?= , Tom Lane Cc: pgsql-general@lists.postgresql.org References: <4LEJPNQI.ZWASSFGA.Q7QOROSI@UY3LDXOV.Y5MUB6GM.BGMWW4SO> From: Adrian Klaver Message-ID: <6b34f8c0-4064-1695-8cdf-5e5469ed7ea0@aklaver.com> Date: Wed, 21 Mar 2018 11:25:54 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <4LEJPNQI.ZWASSFGA.Q7QOROSI@UY3LDXOV.Y5MUB6GM.BGMWW4SO> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 03/21/2018 11:15 AM, Albrecht Dreß wrote: > Hi Adrian & Tom: > > Thanks a lot for your input! > > Am 20.03.18 20:38 schrieb(en) Tom Lane: See comments inline below. > > Unfortunately, in my original post, I confused the primary and secondary > (accessed via the FDW) data bases in my example when I anonymised their > identifiers…  Sorry for the confusion!  The /real/ structure is > >     client ---[libpq]--> my_db ---[FDW]--> ext_db > > and the LOG message is actually related to the “internal” connection, > i.e. ext_db (*not* my_db) complains about “could not receive data” after > accessing the table in ext_db through the FDW from my_db. > > The effect is not limited to Python, but happens with psql, too.  I.e. > running (ext_table is the foreign table mapped into my_db, and a mapping > exists only for user “user”) > > sudo -u user /usr/lib/postgresql/10/bin/psql my_db <<< "select * from > ext_table limit 1;" > > *also* triggers the LOG message Does it also happen when you open a psql session and do?: psql>select * from ext_table limit 1; > > [time stamp/pid] user@ext_db LOG:  could not receive data from client: > Connection reset by peer > >> I don't see any such log messages when testing postgres_fdw here, >> which is odd; why are my results different? > > Yes, that's strange!  I have the following deb packages (from the > stretch-pgdg repo) installed: > > postgresql-10            10.3-1.pgdg90+1 amd64 > postgresql-client-10     10.3-1.pgdg90+1 amd64 > postgresql-client-common 190.pgdg90+1    all > postgresql-common        190.pgdg90+1    all > libpq5:amd64             10.3-1.pgdg90+1 amd64 I am not seeing --contrib which is where I would expect postgres_fdw to come from. Is --contrib installed? If not where is postgres_fdw coming from? > >> 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. > > Hmm, yes, sounds like a sensible explanation. > >> If it's doing that now, I sure don't see where. > > So, if I understand you correctly, this needs to be addressed in > postgres_fdw, and there is nothing I can fix in my setup (except for > suppressing LOG messages) to get rid of the message? > > Thanks again, > Albrecht. -- Adrian Klaver adrian.klaver@aklaver.com