pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rob Sargent <robjsargent@gmail.com>
To: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Subject: psql timeout: who's waiting for whom
Date: Tue, 19 Apr 2022 13:29:04 -0600
Message-ID: <81a2f331-de6a-2c8e-a625-d692ccff7363@gmail.com> (raw)

I'll be asking 'those in charge' to reset some timeout/keep-alive 
setting /somewhere/. I need help in hopefully naming the correct 
setting.  The server is running version 14


Am I dealing with a client issue, a server issue or a mis-match in 
host/postgres configuration values?  If I cannot have psql wait forever, 
I would at least like it to die/reconnect quickly.  What are my options?

If I leave my psql session for long enough, then the first interaction 
(with some exceptions) will be unresponsive for /some time/.  The 
typical, eventual response is a successful re-connection though last one 
was fatal:

    barnard=# \i
    ~/gits/gitlab/sgs5/jooq/src/main/resources/db/scripts/functions/showSegmentCalls.sql

    psql:/uufs/chpc.utah.edu/common/HIPAA/u0138544/gits/gitlab/sgs5/jooq/src/main/resources/db/scripts/functions/showSegmentCalls.sql:22:
    SSL SYSCALL error: Connection timed out
    psql:/uufs/chpc.utah.edu/common/HIPAA/u0138544/gits/gitlab/sgs5/jooq/src/main/resources/db/scripts/functions/showSegmentCalls.sql:23:
    no connection to the server
    psql:/uufs/chpc.utah.edu/common/HIPAA/u0138544/gits/gitlab/sgs5/jooq/src/main/resources/db/scripts/functions/showSegmentCalls.sql:23:
    fatal: connection to server was lost

More typically I get this

    barnard=# select 1;
       C-c C-cCancel request sent
    SSL SYSCALL error: Connection timed out
    barnard=# \c barnard
    psql (12.2, server 14.2)
    WARNING: psql major version 12, server major version 14.
              Some psql features might not work.
    SSL connection (protocol: TLSv1.2, cipher:
    ECDHE-RSA-AES128-GCM-SHA256, bits: 128, compression: off)
    You are now connected to database "barnard" as user "postgres".



The client machine is using default TCP values,

    tcp_keepalive_intvl: 75
    tcp_keepalive_probes: 9
    tcp_keepalive_time: 7200

the dbhost postgresql.conf has tcp_* set to zero (use default)

    #tcp_keepalives_idle = 0                # TCP_KEEPIDLE, in seconds;
                                             # 0 selects the system default
    #tcp_keepalives_interval = 0            # TCP_KEEPINTVL, in seconds;
                                             # 0 selects the system default
    #tcp_keepalives_count = 0               # TCP_KEEPCNT;
                                             # 0 selects the system default
    #tcp_user_timeout = 0                   # TCP_USER_TIMEOUT, in
    milliseconds;
                                             # 0 selects the system default

    #client_connection_check_interval = 0   # time between checks for client
                                             # disconnection while
    running queries;
                                             # 0 for never
    [postgres@csgsdb ipv4]$ for t in tcp_keep*;do printf "%s: " $t; cat
    $t; done
    tcp_keepalive_intvl: 75
    tcp_keepalive_probes: 9
    tcp_keepalive_time: 7200

Thanks

Message-ID: <81a2f331-de6a-2c8e-a625-d692ccff7363@gmail.com>
Permalink:  ../81a2f331-de6a-2c8e-a625-d692ccff7363@gmail.com/
Also on:    postgresql.org/message-id/81a2f331-de6a-2c8e-a625-d692ccff7363@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: robjsargent@gmail.com
  Subject: Re: psql timeout: who's waiting for whom
  In-Reply-To: <81a2f331-de6a-2c8e-a625-d692ccff7363@gmail.com>
  References: <81a2f331-de6a-2c8e-a625-d692ccff7363@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox