Re: [EXTERNAL] Re: PQcancel does not use tcp_user_timeout, connect_timeout and keepalive settings
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jelte Fennema <Jelte.Fennema@microsoft.com>
Cc: Andres Freund <andres@anarazel.de>,
Fujii Masao <masao.fujii@oss.nttdata.com>,
Zhihong Yu <zyu@yugabyte.com>,
"pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2022-01-17T20:39:40Z
Lists: pgsql-hackers
Jelte Fennema <Jelte.Fennema@microsoft.com> writes:
> Thanks for all the cleanup and adding of windows support. To me it now looks good to merge.
I was about to commit this when I started to wonder if it actually does
anything useful. In particular, I read in the Linux tcp(7) man page
TCP_USER_TIMEOUT (since Linux 2.6.37)
...
This option can be set during any state of a TCP connection, but
is effective only during the synchronized states of a connection
(ESTABLISHED, FIN-WAIT-1, FIN-WAIT-2, CLOSE-WAIT, CLOSING, and
LAST-ACK).
ISTM that the case we care about is where the server fails to respond
to the TCP connection request. If it does so, it seems pretty unlikely
that it wouldn't then eat the small amount of data we're going to send.
While the keepalive options aren't so explicitly documented, I'd bet that
they too don't have any effect until the connection is known established.
So I'm unconvinced that setting these values really has much effect
to make PQcancel more robust (or more accurately, make it fail faster).
I would like to know what scenarios you tested to convince you that
this is worth doing.
regards, tom lane
Commits
-
Make PQcancel use the PGconn's tcp_user_timeout and keepalives settings.
- 5987feb70b5b 15.0 landed
-
Avoid calling gettext() in signal handlers.
- d18ec312f9f3 13.6 landed
- 92e6c1c9be15 11.15 landed
- 6d1a854c157e 12.10 landed
- 62bfa554b285 10.20 landed
- 4e8726566e4d 14.2 landed
- 2131c049d338 15.0 landed
-
Avoid calling strerror[_r] in PQcancel().
- 9d66c43eb4c8 10.20 landed
- f3f467b8f69b 15.0 landed
- f27af7b880de 13.6 landed
- 8b107467c632 11.15 landed
- 38f099ef935b 12.10 landed
- 050949877004 14.2 landed