Skip to content

HTTP2: The Request stream either getting reset or closed during the post deplex operation #30310

Closed
dotnet/corefx
#39638

Description

@Anipik

Exceptions being thrown

// Client error

System.Net.Http.HttpRequestException: Error while copying content to a stream.
 ---> System.IO.IOException: An error occurred while sending the request.
 ---> System.OperationCanceledException: The operation was canceled.
   --- End of inner exception stack trace ---
   at System.IO.Stream.CopyToAsyncInternal(Stream destination, Int32 bufferSize, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionResponseContent.SerializeToStreamAsync(Stream stream, TransportContext context, CancellationToken cancellationToken)
   at System.Net.Http.HttpContent.LoadIntoBufferAsyncCore(Task serializeToStreamTask, MemoryStream tempBuffer)
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpContent.LoadIntoBufferAsyncCore(Task serializeToStreamTask, MemoryStream tempBuffer)
   at System.Net.Http.HttpContent.WaitAndReturnAsync[TState,TResult](Task waitTask, TState state, Func`2 returnFunc)
   at Program.<>c__DisplayClass1_0.<<Run>b__9>d.MoveNext() in C:\git\corefx\src\System.Net.Http\tests\StressTests\HttpStress\Program.cs:line 267
--- End of stack trace from previous location where exception was thrown ---
   at Program.<>c__DisplayClass1_4.<<Run>b__40>d.MoveNext() in C:\git\corefx\src\System.Net.Http\tests\StressTests\HttpStress\Program.cs:line 607

// server error

fail: Microsoft.AspNetCore.Server.Kestrel[13]
      Connection id "0HLOCE8NMUALO", Request id "0HLOCE8NMUALO:000001EB": An unhandled exception was thrown by the application.
System.IO.IOException: The client reset the request stream.
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpRequestStream.CopyToAsyncInternal(Stream destination, CancellationToken cancellationToken)
   at Program.<>c.<<Run>b__1_30>d.MoveNext() in C:\git\corefx\src\System.Net.Http\tests\StressTests\HttpStress\Program.cs:line 486
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
fail: Microsoft.AspNetCore.Server.Kestrel[13]
      Connection id "0HLOCE8NMUALO", Request id "0HLOCE8NMUALO:000001EF": An unhandled exception was thrown by the application.
System.IO.IOException: The request stream was aborted.
 ---> Microsoft.AspNetCore.Connections.ConnectionAbortedException: The HTTP/2 connection faulted.
 ---> Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.Http2ConnectionErrorException: HTTP/2 connection error (STREAM_CLOSED): The client sent a DATA frame to closed stream ID 491.
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.Http2Connection.ProcessDataFrameAsync(ReadOnlySequence`1& payload)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.Http2Connection.ProcessRequestsAsync[TContext](IHttpApplication`1 application)
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   at System.IO.Pipelines.PipeCompletion.ThrowLatchedException()
   at System.IO.Pipelines.Pipe.GetReadResult(ReadResult& result)
   at System.IO.Pipelines.Pipe.GetReadAsyncResult()
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.Http2MessageBody.ReadAsync(CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpRequestStream.CopyToAsyncInternal(Stream destination, CancellationToken cancellationToken)
   at Program.<>c.<<Run>b__1_30>d.MoveNext() in C:\git\corefx\src\System.Net.Http\tests\StressTests\HttpStress\Program.cs:line 486
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)

// Trace file output

   at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
[HandlerMessage] poolId: 4831898, workerId: 23081642, requestId: 3775, memberName: SendRequestBodyAsync, message: Failed to send request body: System.Net.Http.HttpRequestException: Error while copying content to a stream.
 ---> System.IO.IOException: The request was aborted.
   at System.Net.Http.Http2Connection.AcquireWriteLockAsync(CancellationToken cancellationToken)
   at System.Net.Http.Http2Connection.StartWriteAsync(Int32 writeBytes, CancellationToken cancellationToken)
   at System.Net.Http.Http2Connection.SendStreamDataAsync(Int32 streamId, ReadOnlyMemory`1 buffer, CancellationToken cancellationToken)
   at System.Net.Http.Http2Connection.Http2Stream.SendDataAsync(ReadOnlyMemory`1 buffer, CancellationToken cancellationToken)
   at System.Net.Http.HttpContent.CopyToAsyncCore(ValueTask copyTask)
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpContent.CopyToAsyncCore(ValueTask copyTask)
   at System.Net.Http.Http2Connection.Http2Stream.SendRequestBodyAsync(CancellationToken cancellationToken)

command dotnet run -n 3 -maxContentLength 1000 -http 2.0 -ops 7

I ran it on the master branch and it error doesn't repro with 1.1

cc @stephentoub @eiriktsarpalis

Activity

  1. stephentoub commented on Jul 19, 2019

    @stephentoub
    Member

    The client sent a DATA frame to closed stream ID 491.

    This is likely just part of all the issues @geoffkizer is addressing.

  2. karelz commented on Aug 3, 2019

    @karelz
    Member

    Fixed in master (5.0) in PR dotnet/corefx#39638 and also in release/3.0 branch (3.0) in PR dotnet/corefx#39775.

  3. transferred this issue fromdotnet/corefxon Feb 1, 2020
  4. added this to the 3.0 milestone on Feb 1, 2020
  5. ghost locked as resolved and limited conversation to collaborators on Dec 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions