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 1f12Qn-0006cA-Ky for pgsql-general@arkaria.postgresql.org; Wed, 28 Mar 2018 04:11:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f12Qm-0006KD-3r for pgsql-general@arkaria.postgresql.org; Wed, 28 Mar 2018 04:11:24 +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 1f12Qk-0006K3-90 for pgsql-general@lists.postgresql.org; Wed, 28 Mar 2018 04:11:23 +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 1f12QW-0000X4-LT for pgsql-general@lists.postgresql.org; Wed, 28 Mar 2018 04:11:21 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id E881320E47; Wed, 28 Mar 2018 00:11:05 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Wed, 28 Mar 2018 00:11:05 -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=i+N2fPMAxwhEme7xp1G2lgdCz2QBf Q/KakmAMwXEplQ=; b=VQbg3pgTK+m63n8j+eWGfXhus2xnmFY4WkOZQOBLkzns8 hT/O8kpjFtqh591B50lF8GtsuQz5HKNccV+fBNM4F+qh3PXDh+f6BU4oH6VahLcI Z097trOCHESOcWzMNmMNHiey0MraUp9nn/yzSicTfOfV9i//utFEbwvC2tORDig0 1Fb4aAlBagsgSC7ETemfcnTOE/fIO08bxpRTqXoXDNz7nLTmFsW9GoZCmWoQ7OBZ OL3jLA0LfAohbzmcFwFqLhVeJEL0iROPqvB/W0cHPbjrGwrk36q0aN6H54IbFRXJ jfTj/P0eTnNjS4iDxuSfVPrU27uEpIA9InOQWd8cw== 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=i+N2fP MAxwhEme7xp1G2lgdCz2QBfQ/KakmAMwXEplQ=; b=fi7mVMwV3xlagNc3zfZK7F dIqKF2B/smihd4ZIl1kngKMSERVMyX1ML70F5tRJr9EQaK6nKpCWwDgU0JIr0cdm a6tuVjLTmQEbtFy48U0dovJooRJynb3yuI0Z9xTMz5wudc9wZSITN/EEmTTBO8Ox qgAGTHC9Fw4j+khO2OfrVCtseav19hXbRd0GQ/wguu0u8wtBXIDALdl+owg4DyNz yUzEmJrhuHZqjXRdAhKsU9tWfQyBrEtRmJ4fEcUR2rXgplEyfivcMwmbZ7jfoM0A MuepI4919BZw8htqf0YFNQuCd6ij7pNMatqLATAZkZX6DsDyXJXqcaEMS5x/v/Lg == X-ME-Sender: Received: from [192.168.1.2] (71-35-123-124.tukw.qwest.net [71.35.123.124]) by mail.messagingengine.com (Postfix) with ESMTPA id 49E031029F; Wed, 28 Mar 2018 00:11:05 -0400 (EDT) Subject: Re: connection dropped from the backend server To: armand pirvu , Tom Lane Cc: pgsql-general@lists.postgresql.org References: <88B8EEC2-917D-498D-938B-DD4C2C3C7008@gmail.com> <9c4890fe-df61-eae9-48c0-f01fbafedf3a@aklaver.com> <5FCACAED-139A-4D38-80AA-895C5884631E@gmail.com> <0b0e0503-0e34-32cd-50a7-9be77601a2a5@aklaver.com> <6164.1522194582@sss.pgh.pa.us> <39D1AF67-3501-48C5-B143-D9F50F28F1E2@gmail.com> From: Adrian Klaver Message-ID: <1e86e8f7-7e7a-1ae4-e3f0-d703eb13be0f@aklaver.com> Date: Tue, 27 Mar 2018 21:11:04 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <39D1AF67-3501-48C5-B143-D9F50F28F1E2@gmail.com> 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/27/2018 07:21 PM, armand pirvu wrote: > >> On Mar 27, 2018, at 6:49 PM, Tom Lane > > wrote: >> >> Adrian Klaver > > writes: >>> On 03/27/2018 04:07 PM, armand pirvu wrote: >>>> As long as the connection stays up yes data gets fine across >>>> In pg_stat_activity I see the node ip address where tail -f piped >>>> into psql happens >> >>> So what does the rest of that record show? In particular for: >> >> I wonder how often data gets put into the pipe.  If it's "not very often", >> maybe the connection from psql to the server is timing out due to >> inactivity?  This would be the fault of a firewall or something in >> between.  You could probably fix it by enabling (more aggressive) TCP >> keepalive settings. >> >> regards, tom lane > > Well there is no flow pattern, The flow can be inexistent for days , > even weeks and then it can get super busy > > The data flows as expected well untill the connection gets dropped. > Bolded from pg_stat_activity (a test I just did) > > birstdb=# select datname, pid, client_addr, client_port, backend_start, > query_start, state from pg_stat_Activity; >  datname |  pid  |  client_addr  | client_port |         backend_start >         |          query_start          | state > ---------+-------+---------------+-------------+-------------------------------+-------------------------------+-------- >  birstdb | 10046 |               |          -1 | 2018-03-27 > 20:40:11.721804-05 | 2018-03-27 20:47:27.118434-05 | active > * birstdb | 10082 | 192.168.1.187 |       55859 | 2018-03-27 > 20:43:55.301216-05 | 2018-03-27 20:46:07.190064-05 | idle* > > > ps -fu armandp >      UID   PID  PPID   C    STIME TTY         TIME CMD >  armandp  3264  3263   0 20:39:13 pts/2       0:00 tail -f > /u1/sys_admin/dba/ingres2birst.fifo >  armandp  3265  3263   0 20:39:13 pts/2       0:00 psql -U csidba -d > birstdb -h 172.16.10.93 > > > > Give it about 10 min at most and  bam out it goes > > birstdb=# select datname, pid, client_addr, client_port, backend_start, > query_start, state from pg_stat_Activity; >  datname |  pid  | client_addr | client_port |         backend_start >       |          query_start          | state > ---------+-------+-------------+-------------+-------------------------------+-------------------------------+-------- >  birstdb | 10208 |             |          -1 | 2018-03-27 > 20:51:25.835382-05 | 2018-03-27 21:08:47.164249-05 | active > > Although the above two processes are still out > > I think the tcp keep alives might help but I am also thinking like a > each min check maybe and if things got in the pipe well dump ‘em to > Postgres. Something along these lines > > Any ideas/suggestions you might have to improve this ? I am not saying Yeah, dump the named pipe idea and just create the connection for the duration of the DML event. > it is perfect far from it, but I kinda took the model/idea from the > Nagios named pipe only that one too runs at x seconds/minutes interval > defined > > > > Thank you both > — Armand -- Adrian Klaver adrian.klaver@aklaver.com