Subject: Can't change tcp_keepalives_idle

From: "Abraham, Danny" <[email-masked]>
Date: Sun, 4 Aug 2024 11:16:21 +0000

Hi,

Change tcp_keepalives_idle in postgresql.conf from 0 to 300 , then pg_ctl reload but it stays with the old 0 value.
Tried restart and it did not work. PG Log says it was changed.
Reset_cal marked OK, but no real change ( ins how)

-[ RECORD 1 ]---+-----------------------------------------------------
name            | tcp_keepalives_idle
setting         | 0
unit            | s
category        | Connections and Authentication / Connection Settings
short_desc      | Time between issuing TCP keepalives.
extra_desc      | A value of 0 uses the system default.
context         | user
vartype         | integer
source          | session
min_val         | 0
max_val         | 2147483647
enumvals        |
boot_val        | 0
reset_val       | 1800
sourcefile      |
sourceline      |
pending_restart | f

Thanks

Danny

---

From: Adrian Klaver <[email-masked]>
Date: Sun, 4 Aug 2024 08:13:10 -0700

source          | session

Something is setting the value for the session.

Have you used

https://www.postgresql.org/docs/current/sql-alterrole.html

or

https://www.postgresql.org/docs/current/sql-alterdatabase.html

to SET tcp_keepalives_idle?

Doing:

select * from pg_db_role_setting ;

will help answer the above.

-- 
Adrian Klaver
[email-masked]

---

From: Tom Lane <[email-masked]>
Date: Sun, 04 Aug 2024 11:43:18 -0400

> Tried restart and it did not work. PG Log says it was changed.

tcp_keepalives_idle isn't implemented on all platforms.  But I'd
expect to see a LOG message in the postmaster log about that, either
something about "setsockopt failed" or "WSAIoctl failed" or "setting
the keepalive idle time is not supported".

Also, if you inquire the value on a non-TCP connection, you'll
get zero because it's not relevant.

			regards, tom lane