Skip to content

Test failure: System.Net.Http.Functional.Tests.HttpClientTest.Send_TimeoutRequestContent_Throws #39056

Closed

Description

@v-haren

failed in job: runtime-libraries outerloop 20200709.1

Error message

Assert.Throws() Failure
Expected: typeof(System.Threading.Tasks.TaskCanceledException)
Actual: typeof(System.Net.Http.HttpRequestException): Error while copying content to a stream.
---- System.Net.Http.HttpRequestException : Error while copying content to a stream.
-------- System.IO.IOException : Unable to write data to the transport connection: An established connection was aborted by the software in your host machine..
------------ System.Net.Sockets.SocketException : An established connection was aborted by the software in your host machine.


Stack trace
   at System.Net.Http.HttpContent.CopyTo(Stream stream, TransportContext context, CancellationToken cancellationToken) in /_/src/libraries/System.Net.Http/src/System/Net/Http/HttpContent.cs:line 388
   at System.Net.Http.HttpConnection.SendRequestContentAsync(HttpRequestMessage request, HttpContentWriteStream stream, Boolean async, CancellationToken cancellationToken) in /_/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnection.cs:line 783
   at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) in /_/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnection.cs:line 446
   at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) in /_/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs:line 760
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) in /_/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/RedirectHandler.cs:line 32
   at System.Net.Http.HttpMessageHandlerStage.Send(HttpRequestMessage request, CancellationToken cancellationToken) in /_/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpMessageHandlerStage.cs:line 17
   at System.Net.Http.SocketsHttpHandler.Send(HttpRequestMessage request, CancellationToken cancellationToken) in /_/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs:line 353
   at System.Net.Http.HttpClientHandler.Send(HttpRequestMessage request, CancellationToken cancellationToken) in /_/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.cs:line 276
   at System.Net.Http.HttpMessageInvoker.Send(HttpRequestMessage request, CancellationToken cancellationToken) in /_/src/libraries/System.Net.Http/src/System/Net/Http/HttpMessageInvoker.cs:line 50
   at System.Net.Http.HttpClient.SendAsyncCore(HttpRequestMessage request, HttpCompletionOption completionOption, Boolean async, CancellationToken cancellationToken) in /_/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs:line 498
   at System.Net.Http.HttpClient.Send(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken) in /_/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs:line 466
   at System.Net.Http.HttpClient.Send(HttpRequestMessage request) in /_/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs:line 449
   at System.Net.Http.Functional.Tests.HttpClientTest.<>c__DisplayClass48_0.<Send_TimeoutRequestContent_Throws>b__2() in /_/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs:line 885
   at System.Threading.Tasks.Task.InnerInvoke() in /_/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:line 2370
   at System.Threading.Tasks.Task.<>c.<.cctor>b__277_0(Object obj) in /_/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:line 2359
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) in /_/src/libraries/System.Private.CoreLib/src/System/Threading/ExecutionContext.cs:line 266
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) in /_/src/libraries/System.Private.CoreLib/src/System/Threading/ExecutionContext.cs:line 266
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) in /_/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:line 2352
--- End of stack trace from previous location ---
----- Inner Stack Trace -----
   at

Activity

  1. stephentoub commented on Jul 10, 2020

    @stephentoub
    Member
  2. self-assigned this
    on Jul 10, 2020
  3. added
    test-bugProblem in test source code (most likely)
    and removed
    untriagedNew issue has not been triaged by the area owner
    on Jul 10, 2020
  4. added this to the 5.0.0 milestone on Jul 10, 2020
  5. modified the milestones: 5.0.0, Future on Jul 28, 2020
  6. added
    disabled-testThe test is disabled in source code against the issue
    on Jul 28, 2020
  7. v-haren commented on Jul 29, 2020

    @v-haren
    Author

    failed again in job: runtime-libraries outerloop 20200728.3

    failed test: System.Net.Http.Functional.Tests.HttpClientTest.Send_TimeoutRequestContent_Throws

    Error message

    Assert.Throws() Failure
    Expected: typeof(System.Threading.Tasks.TaskCanceledException)
    Actual:   typeof(System.Net.Http.HttpRequestException): Error while copying content to a stream.
    ---- System.Net.Http.HttpRequestException : Error while copying content to a stream.
    -------- System.IO.IOException : Unable to write data to the transport connection: An established connection was aborted by the software in your host machine..
    ------------ System.Net.Sockets.SocketException : An established connection was aborted by the software in your host machine.
    
    
    Stack trace
       at System.Net.Http.HttpContent.CopyTo(Stream stream, TransportContext context, CancellationToken cancellationToken) in /_/src/libraries/System.Net.Http/src/System/Net/Http/HttpContent.cs:line 386
       at System.Net.Http.HttpConnection.SendRequestContentAsync(HttpRequestMessage request, HttpContentWriteStream stream, Boolean async, CancellationToken cancellationToken) in /_/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnection.cs:line 793
       at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) in /_/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnection.cs:line 446
       at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) in /_/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs:line 792
       at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) in /_/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/RedirectHandler.cs:line 30
       at System.Net.Http.HttpMessageHandlerStage.Send(HttpRequestMessage request, CancellationToken cancellationToken) in /_/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpMessageHandlerStage.cs:line 17
       at System.Net.Http.SocketsHttpHandler.Send(HttpRequestMessage request, CancellationToken cancellationToken) in /_/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs:line 368
       at System.Net.Http.HttpClientHandler.Send(HttpRequestMessage request, CancellationToken cancellationToken) in /_/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.cs:line 279
       at System.Net.Http.HttpMessageInvoker.Send(HttpRequestMessage request, CancellationToken cancellationToken) in /_/src/libraries/System.Net.Http/src/System/Net/Http/HttpMessageInvoker.cs:line 44
       at System.Net.Http.HttpClient.SendAsyncCore(HttpRequestMessage request, HttpCompletionOption completionOption, Boolean async, CancellationToken cancellationToken) in /_/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs:line 527
       at System.Net.Http.HttpClient.Send(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken) in /_/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs:line 466
       at System.Net.Http.HttpClient.Send(HttpRequestMessage request) in /_/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs:line 449
       at System.Net.Http.Functional.Tests.HttpClientTest.<>c__DisplayClass48_0.<Send_TimeoutRequestContent_Throws>b__2() in /_/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs:line 885
       at System.Threading.Tasks.Task.InnerInvoke() in /_/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:line 2370
       at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) in /_/src/libraries/System.Private.CoreLib/src/System/Threading/ExecutionContext.cs:line 267
    --- End of stack trace from previous location ---
       at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) in /_/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:line 2352
    --- End of stack trace from previous location ---
    ----- Inner Stack Trace -----
       at System.Net.Http.HttpContent.CopyTo(Stream stream, TransportContext context, CancellationToken cancellationToken) in /_/src/libraries/System.Net.Http/src/System/Net/Http/HttpContent.cs:line 386
       at System.Net.Http.HttpConnection.SendRequestContentAsync(HttpRequestMessage request, HttpContentWriteStream stream, Boolean async, CancellationToken cancellationToken) in /_/src/libraries/System.Net.Http/src/System/Net/H
    
  8. ManickaP commented on Jul 29, 2020

    @ManickaP
    Member

    I just merged it now (I was trigger happy with the labels here), so the failure is from before.

  9. ManickaP commented on Jul 29, 2020

    @ManickaP
    Member

    The failure seems to happen predominantly on Windows machine (single alpine occurrence).
    The underlying error: An established connection was aborted by the software in your host machine. corresponds to winsock error: WSAECONNABORTED which points to server closing the connection.
    My working theory is that the server code finishes sooner (not actually expecting the content: ReadRequestBodyAsync returning immediatelly) and closes the connection without waiting on client to send it.
    The test sometimes passes because the client side timeout propagation is faster than the server side code.

  10. added
    in-prThere is an active PR which will close this issue when it is merged
    on Feb 13, 2026
  11. added a commit that references this issue on Feb 16, 2026
    bf62494
  12. added a commit that references this issue on Mar 2, 2026
    6c96678
  13. locked and limited conversation to collaborators on Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.Net.Httpdisabled-testThe test is disabled in source code against the issuein-prThere is an active PR which will close this issue when it is mergedtest-bugProblem in test source code (most likely)test-run-coreTest failures in .NET Core test runs

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions