-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attempting to connect to wrong port (PG post), hangs #370
Comments
Hi Marios, thank you for reporting this. I can confirm it by using, for example:
Because In different spots, I observed others to use default timeout values like those: from urllib3.util.timeout import Timeout
Timeout(connect=2, read=7)
Timeout(connect=3.05, read=27)
Timeout(connect=5.0, read=?)
Timeout(connect=10.0, read=?) Do you think it is a good idea to also set reasonable non-infinite default timeout values for With kind regards, |
I think yes we should. It seems to me that a user would expect to see and error message if connection cannot be established. |
Hm, I am wondering how this would affect long-running queries, considering crash uses the http-endpoint |
@proddata: Long-running queries would fall into the category of the read timeout. We should probably leave this set to "infinite" and only adjust the connect timeout? Otherwise, do you think we should also configure the read timeout to a maximum value by default? If yes, what do think would be an optimal default value? 24 hours? |
+1 for connect timeout. E.g. 5sec by default |
Could we also have some "keep-alive" test that can happen in the background, so even if there is a long running query, we can still get an error that the server(s) is/are disconnected? |
I think there should be none. 24h might be even worse |
This would address the issue that a client issues a long-run query and the hosts it's connected go down, but the client still "thinks" the query is still running. WDYT? |
Dear Marios, sure we can think about such an "availability background check" feature. However, let's track it on behalf of a different issue instead? I think the scope of this one would be to only adjust the connect timeout accordingly. I also think five seconds as a default value, with an option to adjust it, would be fine. With kind regards, |
@amotl Of course, I just wanted to ask here and get opinions, since it's somehow relevant, so we can open a separate issue. |
ReportHi again. GH-421 adds the On this particular case, at least when emulating a server through You can exercise it like this: # Blocks, because read timeout is still infinite.
crash --host "localhost:5433" --timeout=0.42 # Does not block, because read timeout is decreased.
crash --host "localhost:5433" --timeout=0.42,0.42 ConclusionIn this way, GH-421 does not improve the situation as reported by @matriv. OutlookI have no other idea how this can be improved when not adjusting the default read timeout, which I am also -1 about. Maybe it would be a good idea to check if the user aims to unintentionally connect to a port in the
|
How are other clients like e.g. One idea could be to do a fast probing query with a short read timeout at the connection instantiation ( |
It looks like psql behaves in the same way. Running that on macOS, it does not return for the time of writing this.
That will not work. What would "fast" actually mean? What if this "quick/fast probe check" with a lower timeout than the configured one would be below the value needed to actually make the connection work, because the server is far away, or, as you may be referring to, overloaded, or such? |
Final summary and report, cheers. Problem Report
EvaluationWhen connecting to a TCP endpoint "that does not talk the right protocol" 1, and partners can't establish a good conversation, so the request sent by the client will not get answered by the server at all, the conversation on this TCP connection will naturally stall. Unfortunately, the network connection will not be terminated, because there are no measures in place that could make that happen, other than client- and server-side timeout settings. By default, the behaviour is the same with
To reproduce it with both psql and crash, a server that does not talk the right protocol can easily be emulated using netcat 2. Conclusion and ThoughtsTherefore, we are closing this ticket. Please re-open if you feel your issue has not been addressed properly. Thank you for GH-421, which probably would not have happened without your request. Footnotes |
Runs for long time, without returning any error.
The text was updated successfully, but these errors were encountered: