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 1f10jA-0008Bp-Ng for pgsql-general@arkaria.postgresql.org; Wed, 28 Mar 2018 02:22:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f10j9-0002jU-4D for pgsql-general@arkaria.postgresql.org; Wed, 28 Mar 2018 02:22:15 +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 1f10j8-0002jL-H9 for pgsql-general@lists.postgresql.org; Wed, 28 Mar 2018 02:22:14 +0000 Received: from mail-it0-x230.google.com ([2607:f8b0:4001:c0b::230]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1f10j4-0007hb-5o for pgsql-general@lists.postgresql.org; Wed, 28 Mar 2018 02:22:13 +0000 Received: by mail-it0-x230.google.com with SMTP id r19-v6so1756473itc.0 for ; Tue, 27 Mar 2018 19:22:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=/PPqalVKTtmh2DQGdD+trmROPsHJegvCXvOniOuEQKA=; b=oU07ZqG0oab87iJyrAhqiOmprA9IRFHkJS/YH7wxFYelCmyepUXG21gUIX3IJH8K3y q77mmjRgvzIgX3r6vLbziRiXUo3A6eJ76Da6GhV+sLthZhKkku5GIM/X2CNd9KvBGn8J tid84AwG0Ax667ip+k9mgJqPbnZq/HglEQlhfzFo+Q8AfP2Yc5Csl1vWT1FkLvjn4DU9 mtFG/6i/c2n+yqiUQElrs4o5JztOQ5dhtlBqHFqZs55ZheU8Swa11PLM5Sya/YshpDqy EBxg6TgI0sQxWMMbvsBVbKc+PKPu/NxEySLkxAFUc+LEewD71zbQex0E5Yh9OIhUWtoo 5Cqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=/PPqalVKTtmh2DQGdD+trmROPsHJegvCXvOniOuEQKA=; b=jiG9MzydCwLJtD1Pkwkx6ajJvbiiA8Z/F3B83IF3bMPOWZPmBJEUyBFtuAXJpbxv6Q JLLOkEH85Dj1qTIbUgKPwYt137MVhNjfzKq5uPHDlVVnn9MjrLo3P02mbldRhl+WZBL/ XyYOeoLrvHES5H9FXs7Jl0mhGrN2dgN048EE04MMFxNepezIInyE0Aejv+UZJ9CFDzCn vNbWDflDwgi0WI2zIL+AWPXLIYWNXLh+ke8S/DSwwp7Xjz6yueH+MW1+uLM2kXYmgQlL AE+B78yNFaujCuBrwJ5ix3VkzahfLzJAY48nkmL3TAqTNjrTXT+o+2YJIvT1fFl4/vUh mygw== X-Gm-Message-State: AElRT7EkB00HnaoQgKR7o0e+ofDlfp3aHURmbPQRWG/WymTH4+VzWz3V AFPWhY1UUCFcjII2aKwbunaS0aSS X-Google-Smtp-Source: AIpwx49kV/qH1SmQdLT0e+2zZ7h70nUgRbAWnv1jMTuGouYfCa+aRGRGlCqPkUohW6WP9BEwO++a0g== X-Received: by 2002:a24:6f0b:: with SMTP id x11-v6mr1637901itb.129.1522203728890; Tue, 27 Mar 2018 19:22:08 -0700 (PDT) Received: from ?IPv6:2605:a601:2062:d00:a5ac:a847:a6eb:3599? ([2605:a601:2062:d00:a5ac:a847:a6eb:3599]) by smtp.gmail.com with ESMTPSA id e9sm1705295ioj.47.2018.03.27.19.22.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Mar 2018 19:22:08 -0700 (PDT) From: armand pirvu Message-Id: <39D1AF67-3501-48C5-B143-D9F50F28F1E2@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_6053A24E-2FB0-4BDC-B666-DB680A5F46F4" Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: connection dropped from the backend server Date: Tue, 27 Mar 2018 21:21:31 -0500 In-Reply-To: <6164.1522194582@sss.pgh.pa.us> Cc: pgsql-general@lists.postgresql.org To: Tom Lane , Adrian Klaver 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> X-Mailer: Apple Mail (2.3273) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Apple-Mail=_6053A24E-2FB0-4BDC-B666-DB680A5F46F4 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Mar 27, 2018, at 6:49 PM, Tom Lane wrote: >=20 > 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 >=20 >> So what does the rest of that record show? In particular for: >=20 > 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. >=20 > 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=3D# 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 =20 = ---------+-------+---------------+-------------+--------------------------= -----+-------------------------------+-------- 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=3D# 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 =20 = ---------+-------+-------------+-------------+----------------------------= ---+-------------------------------+-------- 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=20 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 =E2=80=98em = to Postgres. Something along these lines Any ideas/suggestions you might have to improve this ? I am not saying = 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 =E2=80=94 Armand= --Apple-Mail=_6053A24E-2FB0-4BDC-B666-DB680A5F46F4 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
On Mar 27, 2018, at 6:49 PM, Tom Lane <tgl@sss.pgh.pa.us> = wrote:

Adrian Klaver <adrian.klaver@aklaver.com> 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=3D# 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=3D# 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 =E2=80=98em to Postgres. Something along these = lines

Any = ideas/suggestions you might have to improve this ? I am not saying 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
=E2=80=94 = Armand
= --Apple-Mail=_6053A24E-2FB0-4BDC-B666-DB680A5F46F4--