-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
reenable ConnectTimeout_PlaintextStreamFilterTimesOut_Throws test #55982
Conversation
Tagging subscribers to this area: @dotnet/ncl Issue DetailsI believe the flakiness is caused because in very slow environments (like certain CI machines), the cancellation token may fire before the server accepts the connection, which will cause the server logic to hang. Fix this by using ConnectCallback to avoid creating a real connection at all. Fixes #55931
|
/azp run runtime-libraries-coreclr outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
@@ -100,24 +97,15 @@ public async Task ConnectTimeout_PlaintextStreamFilterTimesOut_Throws(bool useSs | |||
handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates; | |||
var socketsHandler = GetUnderlyingSocketsHttpHandler(handler); | |||
socketsHandler.ConnectTimeout = TimeSpan.FromSeconds(1); | |||
socketsHandler.ConnectCallback = (context, token) => new ValueTask<Stream>(new MemoryStream()); |
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.
Would this test the connect timeout? In this case, we are already providing "connected" stream, right? e.g. skipping the ConnectAsync
or Connect
calls.
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.
Yeah, since we are providing a ConnectCallback, we skip doing the actual ConnectAsync.
src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Cancellation.cs
Outdated
Show resolved
Hide resolved
/azp run runtime-libraries-coreclr outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
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.
Nit: The releaseServer
TaskCompletionSource
isn't needed after this change.
Since we're not connecting, I assume the LoopbackServer could be removed as well.
/azp run runtime-libraries-coreclr outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
I believe the flakiness is caused because in very slow environments (like certain CI machines), the cancellation token may fire before the server accepts the connection, which will cause the server logic to hang.
Fix this by using ConnectCallback to avoid creating a real connection at all.
Fixes #55931