Hi, all. I'd like to suggest introducing two parameters to handle client-server communication timeouts. That is "tcp_user_timeout" and "socket_timeout" parameter.
I implemented "tcp_user_timeout" parameter in both backend and frontend side. This parameter enables us to use TCP_USER_TIMEOUT option on linux. If the parameter is specified, the process sets the value to TCP_USER_TIMEOUT option. In my opinion, this option is needed for the following situation: If the server can't return an ack packet to the request from the client, the client performs retransmission processing. In this case TCP keepalive option can't work. Therefore we need TCP USER TIMEOUT option. Andrei Yahorau also refer to the necessity of this option in [1]. "socket_timeout" is the application layer timeout parameter from when frontend issues SQL query to when frontend receives the execution result from backend. When this parameter is active and timeout occurs, frontend close the socket. It is a merit for client to set the maximum time to wait for SQL. I'm waiting for your opinions or reviews. [1] https://www.postgresql.org/message-id/flat/OF4C8A68CE.A350F319-ON432582D0.0028A5FF-432582D0.002FEE28%40iba.by Bes regards, --------------------- Ryohei Nagaura
socket_timeout.patch
Description: socket_timeout.patch
TCP_USER_TIMEOUT_in_backend.patch
Description: TCP_USER_TIMEOUT_in_backend.patch
TCP_USER_TIMEOUT_in_interface.patch
Description: TCP_USER_TIMEOUT_in_interface.patch