Re: tcp keepalives not sent during long query

2022-12-15 Thread Willy-Bas Loos
Yes exactly, Geoff Winkless pointed that out too. I thought I'd found a cause for the breaking connections, but I hadn't. Thanks a lot for your help! On Thu, Dec 15, 2022 at 3:48 PM Tom Lane wrote: > Willy-Bas Loos writes: > > It gives me a confirmation, but then when I SHOW the value, it give

Re: tcp keepalives not sent during long query

2022-12-15 Thread Tom Lane
Willy-Bas Loos writes: > It gives me a confirmation, but then when I SHOW the value, it gives me 0. > wbloos=# set tcp_keepalives_idle=120; > SET > wbloos=# show tcp_keepalives_idle; > tcp_keepalives_idle > - > 0 > (1 row) That's the behavior I'd expect on a local (Unix-soc

Re: tcp keepalives not sent during long query

2022-12-15 Thread Willy-Bas Loos
On Thu, Dec 15, 2022 at 2:04 PM Geoff Winkless wrote: > > Are you connected in this psql session via tcp or unix domain socket? > > Right, got me again. That was a Unix-domain socket. When I do SHOW tcp_keepalives_idle; from pgAdmin it shows me 120, which is correct. Thanks for clarifying that.

Re: tcp keepalives not sent during long query

2022-12-15 Thread Geoff Winkless
On Thu, 15 Dec 2022 at 07:31, Willy-Bas Loos wrote: > > wbloos=# set tcp_keepalives_idle=120; > SET > wbloos=# show tcp_keepalives_idle; > tcp_keepalives_idle > - > 0 Are you connected in this psql session via tcp or unix domain socket? "In sessions connected via a Unix-dom

Re: tcp keepalives not sent during long query

2022-12-15 Thread Willy-Bas Loos
Nice query, i keep learning new stuff here. Anyway, that shows the correct line (80) in the config file, but the wrong value. Namely 0, where the config file has 120 On Thu, Dec 15, 2022 at 12:37 PM Laurenz Albe wrote: > On Thu, 2022-12-15 at 08:31 +0100, Willy-Bas Loos wrote: > > On Wed, Dec 14

Re: tcp keepalives not sent during long query

2022-12-15 Thread Laurenz Albe
On Thu, 2022-12-15 at 08:31 +0100, Willy-Bas Loos wrote: > On Wed, Dec 14, 2022 at 6:38 PM Tom Lane wrote: > > It'd be worth doing > > > > show tcp_keepalives_idle; > > Wow, you're right! It's in the postgresql.conf but it isn't set when I reload > the server > A restart also doesn't do it and

Re: tcp keepalives not sent during long query

2022-12-14 Thread Willy-Bas Loos
The version is PostgreSQL 13.8 (Debian 13.8-0+deb11u1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit

Re: tcp keepalives not sent during long query

2022-12-14 Thread Willy-Bas Loos
On Wed, Dec 14, 2022 at 6:38 PM Tom Lane wrote: > It'd be worth doing > > show tcp_keepalives_idle; > > Wow, you're right! It's in the postgresql.conf but it isn't set when I reload the server A restart also doesn't do it and even doing SET tcp_keepalives_idle=120; doesn't work. It gives me a con

Re: tcp keepalives not sent during long query

2022-12-14 Thread Tom Lane
Willy-Bas Loos writes: > Thanks for your answer. I was afraid someone would say that... > I was hoping that the keepalives would be more of a matter of cooperation > between postgres and the OS. No, we just apply the setting to the open socket and trust the OS to do it. Are you quite certain tha

Re: tcp keepalives not sent during long query

2022-12-14 Thread Willy-Bas Loos
Thanks for your answer. I was afraid someone would say that... I was hoping that the keepalives would be more of a matter of cooperation between postgres and the OS. On Wed, Dec 14, 2022 at 10:52 AM Laurenz Albe wrote: > On Wed, 2022-12-14 at 08:55 +0100, Willy-Bas Loos wrote: > > Some users of

Re: tcp keepalives not sent during long query

2022-12-14 Thread Laurenz Albe
On Wed, 2022-12-14 at 08:55 +0100, Willy-Bas Loos wrote: > Some users of our database have a NAT firewall and keep a postgres client > (e.g. pgAdmin ) > open for hours. To prevent the connection from being killed by the firewall > due to inactivity, > we configured tcp_keepalives_idle = 120 so th

tcp keepalives not sent during long query

2022-12-13 Thread Willy-Bas Loos
Hi! Some users of our database have a NAT firewall and keep a postgres client (e.g. pgAdmin ) open for hours. To prevent the connection from being killed by the firewall due to inactivity, we configured tcp_keepalives_idle = 120 so that the server sends keepalives and keeps the connection active.