Skip to content

HTTP/3: Hang when reading content or disposing response when SerializeToStreamAsync doesn't complete #92390

@JamesNK

Description

@JamesNK

Description

Dependency update from dotnet/aspnetcore#50362 caused new behavior in some tests.

Some tests hang on reading to the end of the response:

  • POST_ServerCompletesWithoutReadingRequestBody_ClientGetsResponse hangs here

Some tests hang on disposing the response:

  • POST_ClientCancellationBidirectional_RequestAbortRaised(protocol: Http3) hangs here

Consistent between the tests is we have streaming request content via StreamingHttpContent. In the tests we're not completing the request stream so SerializeToStreamAsync doesn't exit.

Note: The implementation of SerializeToStreamAsync is listening to the cancellation token. I don't know if it was canceled before and isn't now, or if it should be canceled at all, but it isn't when I debug the tests.

It seems like wrong behavior for the request stream not being completed to cause a hang when reading to the end of response data (the server in POST_ServerCompletesWithoutReadingRequestBody_ClientGetsResponse has sent its data and completed), or aborting the response via dispose.

Reproduction Steps

See tests above.

Expected behavior

Either:

  • The cancellation token to SerializeToStreamAsync is canceled when the response finishes or the HttpResponseMessage.Dispose() is called, or
  • SerializeToStreamAsync not exiting doesn't hang finishing reading the response or aborting

Actual behavior

Hangs

Regression?

Worked in .NET 8

Known Workarounds

No response

Configuration

.NET 9 latest from dotnet/aspnetcore#50362

Other information

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions