> On Jun 22, 2020, at 10:07 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Hmm. If the client thinks the server dropped the connection, but the
> server thinks the connection is still live, that smells strongly of
> network-level disconnects. Does the client let the connection sit idle
> for more than a minute or two at a time? If so I'd bet that some firewall
> in between is deciding that the connection is dead and dropping it.
> Again, setting the server's tcp_keepalives_* settings could help fix that,
> by ensuring that the network connection sees some traffic regularly.
The gem says it used something in the connection pool. Then it says the server dropped it. Like I said, I’m not clear
whoowns the connections or the connection pool, as the pool can be outdated. There’s a check in the gem to check the
connectionpool for valid connections, over a set amount of time (it’s variable and I can change it, but it does add
overhead). I think that default is 60 minutes.
The client (this gem) throws an error. I don’t think any firewall is on this server that I know of.
Note: This error shows up first thing in the morning sometimes. I’ve not had it in about a week now. I have reduced
themax_connections to 30, and the connections are now at 4. I have a bunch of queries on the top page (it’s a
dashboard)and it just increased from 2 to 4.
I just set the tcp_keepalives_* to around 3, so we’ll see what’s going on. Another page request has connections up to
8:
select datid, datname, numbackends, xact_commit, stats_reset from pg_stat_database where datname in (‘mydatabase')
Cheers, Bee