-
Notifications
You must be signed in to change notification settings - Fork 843
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
Set SocketsHttpHandler.ConnectTimeout to 15 seconds by default #1833
Conversation
@miha, the change to SocketsHttpHandler's ConnectTimeout default was reverted, correct? |
Yes, that change was reverted. The default We went a different route in runtime with dotnet/runtime#71785. A connection attempt will now be canceled 5 seconds after the request that started it is completed/canceled. The issue mentioned in the linked comment about wasting connection attempts on canceled requests is also no longer a problem as we backported mitigations for that to 6.0 (dotnet/runtime#66990). That said, the reason the change to 15 seconds was reverted is not that the change is bad in itself. YARP is in a different situation here given that we are the ones calling into I would be okay with changing the default to 15s in YARP, but I don't think we should be linking to that comment as justification. The reason for doing so is not to avoid "connection leaks", but to avoid potential memory leaks/higher request failure rates. |
For reference, this is the issue tracking making such changes in YARP: #1678 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mahpate can you please also update this property in other places where we specify these defaults:
@@ -48,7 +48,7 @@ public HttpMessageInvoker CreateClient(ForwarderHttpClientContext context) | |||
AutomaticDecompression = DecompressionMethods.None, | |||
UseCookies = false, | |||
ActivityHeadersPropagator = new ReverseProxyPropagator(DistributedContextPropagator.Current), | |||
|
|||
ConnectTimeout = TimeSpan.FromSeconds(15), // See: https://github.com/dotnet/runtime/issues/66673#issuecomment-1073811798 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ConnectTimeout = TimeSpan.FromSeconds(15), // See: https://github.com/dotnet/runtime/issues/66673#issuecomment-1073811798 | |
ConnectTimeout = TimeSpan.FromSeconds(15), |
@mahpate are you still interested in making this change? |
@mahpate are you able to apply the recommended fixes here? Feel free to reopen the PR if you wish to continue working on this change. |
Fixes #1678
Setting SocketsHttpHandler.ConnectTimeout to 15 seconds as default value in .Net 7.
See dotnet/runtime#66673 (comment)