On Tue, 29 Sep 2020 16:22:18 +0300
Олег Самойлов <splarv@ya.ru> wrote:
[...]
> > In regards with keepalive parameters, I am a bit surprised. According to the
> > source code, parameters defaults are:
> >
> > keepalives=1
> > keepalives_idle=1
> > keepalives_interval=1
> > keepalives_count=1
> >
> > But I just had a quick look there, so I probably miss something.
I did miss something. See bellow.
> According to the official documentation, if keepalive parameters are not
> specified, then used default value from the OS.
> https://www.postgresql.org/docs/12/runtime-config-connection.html#RUNTIME-CONFIG-CONNECTION-SETTINGS
This settings are related to the server side.
The one you are setting in primary_conninfo are related to the client side:
https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PARAMKEYWORDS
> Cite: A value of 0 (the default) selects the operating system's default.
>
> I don't know what is the default values for the CentOS 7.
sysctl -ar net.ipv4.tcp_keepalive_
> I can only assert that adding keepalive is solved issue with Postgres-STOP
> test and looked like problems with ForkBomb too. And keep in mind, I still
> use PostgreSQL 11. May be 12 or 13 something changed.
Sorry, there was some misunderstanding of the source code on my side. The
"keepalives" parameter is enabled by default on client side, but if you don't
set keepalives_idle, keepalives_interval and keepalives_count, they fallback to
system default ones which are 7200, 75 and 9 (on Debian and CentOS). So more
than 2 hours.
Regards,