Skip to content
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

Test failure: SendAsync_SlowServerRespondsAfterDefaultReceiveTimeout_ThrowsHttpRequestException #20675

Closed
stephentoub opened this issue Mar 17, 2017 · 12 comments · Fixed by #93025
Assignees
Labels
area-System.Net.Http os-windows test-bug Problem in test source code (most likely) test-run-core Test failures in .NET Core test runs
Milestone

Comments

@stephentoub
Copy link
Member

https://ci.dot.net/job/dotnet_corefx/job/master/job/outerloop_windows_nt_debug_prtest/148/consoleText
https://ci.dot.net/job/dotnet_corefx/job/master/job/outerloop_windows_nt_debug_prtest/147/consoleText

System.Net.Http.WinHttpHandlerFunctional.Tests.WinHttpHandlerTest.SendAsync_SlowServerRespondsAfterDefaultReceiveTimeout_ThrowsHttpRequestException [FAIL]
        Assert.Throws() Failure
        Expected: typeof(System.AggregateException)
        Actual:   (No exception was thrown)
        Stack Trace:
           D:\j\workspace\outerloop_win---7ad0ce03\src\System.Net.Http.WinHttpHandler\tests\FunctionalTests\WinHttpHandlerTest.cs(109,0): at System.Net.Http.WinHttpHandlerFunctional.Tests.WinHttpHandlerTest.SendAsync_SlowServerRespondsAfterDefaultReceiveTimeout_ThrowsHttpRequestException()
@karelz
Copy link
Member

karelz commented Mar 17, 2017

cc @Priya91 @ianhays @steveharter

@davidsh
Copy link
Contributor

davidsh commented Mar 17, 2017

This test is never going to be 100% reliable in CI. In general, testing cancellation is problematic because cancellation is "cooperative" and not guaranteed. So, in some cases when the CI machine is busy, it might be possible for the cancellation request to take longer than the actual HTTP request. Which means the request succeeds and thus the test fails because the request was not cancelled.

@stephentoub
Copy link
Member Author

Why can't it just go against a loopback page that never finishes the request? Then cancellation/timeout can be issued at any point after we issue it. In fact we already have such a test:
https://github.com/dotnet/corefx/blob/09f9d0beb74fa254e9e26e246ee81ce0a263eeda/src/System.Net.Http/tests/FunctionalTests/CancellationTest.cs#L31

@stephentoub
Copy link
Member Author

@davidsh
Copy link
Contributor

davidsh commented Mar 17, 2017

Why can't it just go against a loopback page that never finishes the request? Then cancellation/timeout can be issued at any point after we issue it. In fact we already have such a test:

That could be an option. I had previously thought the WinHttpHandlerTest was already against a loopback server.

@stephentoub
Copy link
Member Author

stephentoub commented Mar 17, 2017

Do we need this WinHttpHandler-specific test at all, since the test I linked to would seem to cover the same functionality?

@davidsh
Copy link
Contributor

davidsh commented Mar 17, 2017

Do we need this WinHttpHandler-specific test at all, since the test I linked to would seem to cover the same functionality?

WinHttpHandler.ReceiveTimeout is different from HttpClient.Timeout. In fact, when HttpClient uses HttpClientHandler, it internally sets all the WinHttpHandler timeouts to "infinite". The cancellation mechansim is very different in the HttpClient.TImeout test compared to WinHttpHandler.ReceiveTimeout

If we want good code coverage of the WinHttpHandler specific properties, then we need this test in some way.

@stephentoub
Copy link
Member Author

I see, I didn't notice it was a different timeout property. In that case the test we have could be duplicated and modified.

stephentoub referenced this issue in dotnet/corefx Mar 17, 2017
@karelz
Copy link
Member

karelz commented Apr 18, 2017

Given that this is test issue only and that the product actually works and that we do not have infinite time, moving to Future. It would be still nice to have it fixed in 2.0.

@hughbe are you interested? ;-)

@karelz karelz changed the title SendAsync_SlowServerRespondsAfterDefaultReceiveTimeout_ThrowsHttpRequestException failing in CI Test failure: SendAsync_SlowServerRespondsAfterDefaultReceiveTimeout_ThrowsHttpRequestException Apr 4, 2018
@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the Future milestone Jan 31, 2020
@ManickaP ManickaP modified the milestones: Future, 9.0.0 Sep 19, 2023
@ManickaP
Copy link
Member

Triage: fix the test as suggested above.

@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Oct 4, 2023
@liveans liveans self-assigned this Oct 4, 2023
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Oct 7, 2023
@liveans
Copy link
Member

liveans commented Oct 10, 2023

It's still failing after the change, (6 occurrences (2 fail, 4 pass on rerun)).
Reopening for further investigation

@liveans liveans reopened this Oct 10, 2023
@liveans liveans removed the disabled-test The test is disabled in source code against the issue label Jun 2, 2024
@liveans
Copy link
Member

liveans commented Jun 2, 2024

Duplicate of #96481

@liveans liveans marked this as a duplicate of #96481 Jun 2, 2024
@liveans liveans closed this as completed Jun 2, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jul 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Net.Http os-windows test-bug Problem in test source code (most likely) test-run-core Test failures in .NET Core test runs
Projects
None yet
6 participants