Re: [EXTERNAL] Re: PQcancel does not use tcp_user_timeout, connect_timeout and keepalive settings
Jelte Fennema-Nio <jelte.fennema@microsoft.com>
From: Jelte Fennema <Jelte.Fennema@microsoft.com>
To: Zhihong Yu <zyu@yugabyte.com>
Cc: "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2021-10-06T19:58:32Z
Lists: pgsql-hackers
Attachments
- 0001-Use-tcp_user_timeout-and-keepalives-in-PQcancel.patch (application/octet-stream) patch 0001
Ugh forgot to attach the patch. Here it is. ________________________________ From: Jelte Fennema <Jelte.Fennema@microsoft.com> Sent: Wednesday, October 6, 2021 21:56 To: Zhihong Yu <zyu@yugabyte.com> Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org> Subject: Re: [EXTERNAL] Re: PQcancel does not use tcp_user_timeout, connect_timeout and keepalive settings We actually ran into an issue caused by this in production, where a PQcancel connection was open on the client for a 2+ days because the server had restarted at the wrong moment in the cancel handshake. The client was now indefinitely waiting for the server to send an EOF back, and because keepalives were not enabled on this socket it was never closed. I attached an updated patch which also uses the keepalive settings in PQ. The connect_timeout is a bit harder to get it to work. As far as I can tell it would require something like this. https://stackoverflow.com/a/2597774/2570866 > The other field names are quite short. How about naming the field tcp_timeout ? I kept the same names as in the pg_conn struct for consistency sake.
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