public inbox for [email protected]  
help / color / mirror / Atom feed
From: Alvaro Herrera <[email protected]>
To: KK CHN <[email protected]>
Cc: pgsql-general <[email protected]>
Subject: Re: CLOSE_WAIT pileup and Application Timeout
Date: Mon, 7 Oct 2024 16:31:38 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAKgGyB8zMUzJSMQL8ryc-73aG3YEhWj4hGkqtOBT_yywesyCHQ@mail.gmail.com>

On 2024-Oct-07, KK CHN wrote:

> On Mon, Oct 7, 2024 at 12:07 AM Alvaro Herrera <[email protected]>
> wrote:

> Where do I have to introduce the TCP keepalives ? in the OS level or
> application code level ?
> 
> [root@dbch wildfly-27.0.0.Final]# cat /proc/sys/net/ipv4/tcp_keepalive_time
> 7200
> [root@dbch wildfly-27.0.0.Final]# cat /proc/sys/net/ipv4/tcp_keepalive_intvl
> 75
> [root@dbch wildfly-27.0.0.Final]# cat
> /proc/sys/net/ipv4/tcp_keepalive_probes
> 9
> [root@dbch wildfly-27.0.0.Final]#
> 
> These are the default values in the OS level.   Do I need to reduce all the
> above three values to  say 600, 20, 5  ?   Or need to be handled in the
> application backend code ?

My understanding is that these values have no effect unless the socket
gets
  setsockopt( ... , SO_KEEPALIVE, ...)

So that's definitely something that the app needs to do -- it's not
enabled automatically.

With these default settings, the connection would be closed about 2:11
after going quiet, so if your problem manifests only a week later, you
would have enough time for these to be cleaned up.  But of course you
should monitor what happens.


> > I wonder if the connections from Wildfly to Postgres use SSL?  Because
> > there are reported cases where TCP connections are kept and accumulate,
> > causing problems -- but apparently SSL is a necessary piece for that to
> > happen.
> >
> No SSL in between   Wildfly (8080 ) to    PGSQL(5432).

Okay, that's unlikely to be relevant then.

-- 
Álvaro Herrera        Breisgau, Deutschland  —  https://www.EnterpriseDB.com/
"Linux transformó mi computadora, de una `máquina para hacer cosas',
en un aparato realmente entretenido, sobre el cual cada día aprendo
algo nuevo" (Jaime Salinas)






view thread (5+ messages)

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: CLOSE_WAIT pileup and Application Timeout
  In-Reply-To: <[email protected]>

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

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