Skip to content

reenable ConnectTimeout_PlaintextStreamFilterTimesOut_Throws test - #55982

Merged
geoffkizer merged 3 commits into
dotnet:mainfrom
geoffkizer:fixplaintexttest
Jul 21, 2021
Merged

geoffkizer merged 3 commits into
dotnet:mainfrom
geoffkizer:fixplaintexttest

Conversation

@geoffkizer

Copy link
Copy Markdown
Contributor

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

@ghost ghost added the area-System.Net.Http label Jul 20, 2021
@ghost

ghost commented Jul 20, 2021

Copy link
Copy Markdown

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

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

Author: geoffkizer
Assignees: -
Labels:

area-System.Net.Http

Milestone: -

@geoffkizer

Copy link
Copy Markdown
Contributor Author

/azp run runtime-libraries-coreclr outerloop

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates;
var socketsHandler = GetUnderlyingSocketsHttpHandler(handler);
socketsHandler.ConnectTimeout = TimeSpan.FromSeconds(1);
socketsHandler.ConnectCallback = (context, token) => new ValueTask<Stream>(new MemoryStream());

Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown
Contributor Author

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.

@geoffkizer

Copy link
Copy Markdown
Contributor Author

/azp run runtime-libraries-coreclr outerloop

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@MihaZupan MihaZupan left a comment

Copy link
Copy Markdown
Member

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.

@geoffkizer

Copy link
Copy Markdown
Contributor Author

/azp run runtime-libraries-coreclr outerloop

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@geoffkizer
geoffkizer merged commit 016851a into dotnet:main Jul 21, 2021
@geoffkizer
geoffkizer deleted the fixplaintexttest branch July 21, 2021 22:39
@karelz karelz added this to the 6.0.0 milestone Jul 22, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Aug 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression test: ConnectTimeout_PlaintextStreamFilterTimesOut_Throws

4 participants