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
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_ClientGetsResponsehangs hereSome tests hang on disposing the response:
POST_ClientCancellationBidirectional_RequestAbortRaised(protocol: Http3)hangs hereConsistent between the tests is we have streaming request content via StreamingHttpContent. In the tests we're not completing the request stream so
SerializeToStreamAsyncdoesn't exit.Note: The implementation of
SerializeToStreamAsyncis 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_ClientGetsResponsehas sent its data and completed), or aborting the response via dispose.Reproduction Steps
See tests above.
Expected behavior
Either:
SerializeToStreamAsyncis canceled when the response finishes or theHttpResponseMessage.Dispose()is called, orSerializeToStreamAsyncnot exiting doesn't hang finishing reading the response or abortingActual behavior
Hangs
Regression?
Worked in .NET 8
Known Workarounds
No response
Configuration
.NET 9 latest from dotnet/aspnetcore#50362
Other information
No response