Closed
Description
When sending custom content in H/2 and using simple echo server. Then client disposes the response which might send RESET
before the last DATA
frame with END_STREAM
flag leading to a server-side exception:
System.IO.IOException: The client reset the request stream.
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpRequestStream.ReadAsyncInternal(Memory`1 destination, CancellationToken cancellationToken)
The root of the issue resides in sending END_STREAM
completely asynchronously.
- In case when our own predefined contents are used, this frame is send asynchronously and might be sent after
SendAsync
has finished. - In case custom content is used, the end of its
SerializeToStreamAsync
is not a strong indicator that theEND_STREAM
has been sent, it still happens completely asynchronously.
Relates to #1511