-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
PendingConnectionTimeout logic can be too aggressive in certain scenarios #74581
Comments
Tagging subscribers to this area: @dotnet/ncl Issue DetailsCreating an issue based on discussion on the PR - #71785 (comment). With #71785, we now tear down connection attempts after 5 seconds if the request that triggered the attempt is canceled. I fear that this will cause problems in cases where users are expecting their
In these scenarios, you could end up with the following behavior:
I think we should consider only setting the PendingConnectionTimeout if the
|
Cancellation after PendingConnectionTimeout only kicks in only if the originating request completes either by (1) succeeding or (2) after a request timeout. In case (1) there will be at least one working connection that should eventually serve all queued requests. In case (2), timeouts are not unexpected. |
If every connection attempt takes longer than (RequestTimeout + 5 seconds), then in case (2) you go from "some timeouts" in 6.0 to "all requests always fail" in 7.0. And even in case (1), having a max of one connection is not ideal. |
We had the same behavior pre-6.0, I don't think it's incorrect. I would expect RequestTimeout to consider connection times, the fact that we pool connections (& spin them up in the background) is an implementation detail.
I'm not 100% sure if we will max at one connection, but we should investigate. If it turns out to be a problem, another mitigation might be to dynamically increase PendingConnectionTimeout when we detect successful connections taking longer than the current PendingConnectionTimeout. Expecting the user to change the infinite ConnectTimeout to a smaller arbitrary value to avoid timeouts feels counter-intuitive to me. |
I agree this is a 6.0 => 7.0 issue.
The fact that we pool connections is the contract. How exactly we do it are technically implementation details, but they have functional differences that can break users moving from 6.0 to 7.0.
That's a very good point. It would only help users that chose upper limits for the |
Triage: This may be potentially a breaking change from 6.0 to 7.0. In general, it is really weird to have ConnectionTimeout > RequestTimeout. We have to decide what to do in such situations. |
Triage: We believe this should be a corner case. We're unlikely to make any changes here unless we get customer feedback that someone is hitting it. |
Creating an issue based on discussion on the PR - #71785 (comment).
With #71785, we now tear down connection attempts after 5 seconds if the request that triggered the attempt is canceled.
With busy client/server communication with many requests over multiple connections, that has an affect similar to setting the
ConnectTimeout
to 5 seconds.I fear that this will cause problems in cases where users are expecting their
ConnectTimeout
to be honored even if it's longer than 5 seconds.There are cases where the connection establishment (emphasis on TLS handshakes) can take longer than 5 seconds and the client is okay with that. We saw two such users in #11594:
#11594 (comment),
#11594 (comment)
In these scenarios, you could end up with the following behavior:
Note: this sort of setup (ConnectTimeout > RequestTimeout) would only make sense >= 6.0.
In .NET 5.0 and earlier, we would always kill the connection attempt, so you'd also never get any connections/requests through.
I think we should consider only setting the PendingConnectionTimeout if theThis isn't a great solution either.ConnectTimeout
was not manually changed from infinite. This gives the user a reasonable way to tell us they're fine with connection attempts taking a long time, without having to set the AppContext switch.The text was updated successfully, but these errors were encountered: