From: | "Jamison, Kirk" <k(dot)jamison(at)jp(dot)fujitsu(dot)com> |
---|---|
To: | "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>, "Nagaura, Ryohei" <nagaura(dot)ryohei(at)jp(dot)fujitsu(dot)com> |
Cc: | 'Michael Paquier' <michael(at)paquier(dot)xyz>, "AYahorau(at)ibagroup(dot)eu" <AYahorau(at)ibagroup(dot)eu>, 'Fabien COELHO' <coelho(at)cri(dot)ensmp(dot)fr>, "'pgsql-hackers(at)postgresql(dot)org'" <pgsql-hackers(at)postgresql(dot)org>, "MikalaiKeida(at)ibagroup(dot)eu" <MikalaiKeida(at)ibagroup(dot)eu> |
Subject: | RE: Timeout parameters |
Date: | 2019-02-21 08:20:55 |
Message-ID: | D09B13F772D2274BB348A310EE3027C643DF30@g01jpexmbkw24 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thursday, February 21, 2019 2:56 PM (GMT+9), Tsunakawa, Takayuki wrote:
>> 1) tcp_user_timeout parameter
>> I think this can be "committed" separately when it's finalized.
> Do you mean you've reviewed and tested the patch by simulating a
> communication failure in the way Nagaura-san suggested?
Although I did review and followed the suggested way in previous email
way back (which uses root user) and it worked as intended, I'd also like
to hear feedback also from Fabien whether it's alright without the test
script, or if there's another way we can test it (maybe none?).
Then I think it's in good shape.
However, what I meant by my statement above was to have a separate
decision in committing the two parameters, because based from the thread
tcp_user_timeout has got more progress when it comes to reviews.
So once it's ready, it can be committed separately without waiting for
the socket_timeout param to be ready. (I dont think that requires a
separate thread)
>> 2) tcp_socket_timeout parameter
>> - whether (a) it should abort the connection from pqWait() or
>> other means, or
>> (b) cancel the statement similar to how psql
>> does it as suggested by Fabien
> We have no choice but to terminate the connection, because we can't tell
> whether we can recover from the problem and continue to use the connection
> (e.g. long-running query) or not (permanent server or network failure).
>
> Regarding the place, pqWait() is the best (and possibly only) place.
> The purpose of this feature is to avoid waiting for response from the
> server forever (or too long) in any case, as a last resort.
Thank you for explaining further. I think that clarifies the implementation
argument on why it needs to terminate the connection over cancelling the query.
In short, I think it's intended purpose is to prevent dead connection.
It addresses the case for when network or server failure occurs and
when DBMS is terminated abruptly. So far, no existing parameter covers that yet.
As for the place, my knowledge is limited so I won't be able to provide
substantial help on it. Fabien pointed out some comments about it that needs
clarification though.
Quoting what Fabien wrote:
"The implementation looks awkward, because part of the logic of pqWaitTimed
is reimplemented in pqWait. Also, I do not understand the computation
of finish_time, which seems to assume that pqWait is going to be called
immediately after sending a query, which may or may not be the case, and
if it is not the time() call there is not the start of the statement."
> Oracle has similar parameters called SQLNET.RECV_TIMEOUT and SQLNET.SEND_TIMEOUT.
> From those names, I guess they use SO_RCVTIMEO and SO_SNDTIMEO socket options.
> However, we can't use them because use non-blocking sockets and poll(), while
> SO_RCV/SND_TIMEO do ont have an effect for poll():
> [..snipped]
>
>> - proper parameter name
>
> I think the name is good because it indicates the socket-level timeout.
> That's just like PgJDBC and Oracle, and I didn't feel strange when I read their manuals.
Agree. I'm actually +1 with tcp_socket_timeout
>> Perhaps you could also clarify a bit more through documentation on how
>> socket_timeout handles the timeout differently from statement_timeout
>> and tcp_user_timeout.
> Maybe. Could you suggest good description?
Ok. I just realized that requires careful explanation.
How about the one below?
I got it from combined explanations above. I did not include the
differences though. This can be improved as the discussion
continues along the way.
tcp_socket_timeout (integer)
Terminate and restart any session that has been idle for more than
the specified number of milliseconds to prevent client from infinite
waiting for server due to dead connection. This can be used both as
a brute force global query timeout and detecting network problems.
A value of zero (the default) turns this off.
Regards,
Kirk Jamison
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2019-02-21 08:36:12 | Re: insensitive collations |
Previous Message | Michael Paquier | 2019-02-21 08:11:24 | Re: restrict pg_stat_ssl to superuser? |