RE: Timeout parameters
mikalaikeida@ibagroup.eu
From: MikalaiKeida@ibagroup.eu
To: "Tsunakawa, Takayuki" <tsunakawa.takay@jp.fujitsu.com>
Cc: "AYahorau@ibagroup.eu" <AYahorau@ibagroup.eu>, Fabien COELHO <coelho@cri.ensmp.fr>, "Jamison, Kirk" <k.jamison@jp.fujitsu.com>, "Michael Paquier" <michael@paquier.xyz>, "Nagaura, Ryohei" <nagaura.ryohei@jp.fujitsu.com>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>, Robert Haas <robertmhaas@gmail.com>
Date: 2019-03-15T07:26:59Z
Lists: pgsql-hackers
Hello Takayuki-san, > Yes, so I think it would be necessary to describe how to set socket_timeout with relation to other timeout parameters -- socket_timeout > statement_timeout, emphasizing that socket_timeout is not for canceling long-running queries but for returning control to the client. For me it does not look enough. If you would like to implement the 'socket_timeout' parameter, could you pay attention on the Fabien Coelho comment? > The fact that no answer data is received may mean that it takes time to > compute the result, so cancelling seems appropriate to me, rather than > severing the connection and starting a new one immediately, leaving the > server loaded with its query. This comment is very important to pay attention on. Let's imagine once more: 1. end-user makes a query 2. the query has not completed within this timeout due to any reason: the query is too 'heavy', some problem with OS happened, PostgreSQL server terminated 3. if we simple close connection, the first case is negative by mistake. To avoid such a situation I think it would be better to call a PQcancel(). In case of failure PQcancel() terminates in 'socket_timeout'. So, control to the end-user in such a failure situation will be returned in 2 * 'socket_timeout' interval. It is much better than hanging forever in some specific cases. Moreover, such solution will not lead to the overloading of PostgreSQL server by abnormally ignored 'heavy' queries results by end-users. What do you think about it? Best regards, Mikalai Keida
Commits
-
Add support TCP user timeout in libpq and the backend server
- 249d64999615 12.0 landed