Skip to content

QuicStream.ReadsClosed doesn't always complete on connection disposal #77216

@bentoi

Description

@bentoi

Description

Depending on the amount of data buffered on the stream, awaiting on QuicStream.ReadsClosed might not complete with an exception if the connection is closed/disposed.

Reproduction Steps

Here's the test case project: quictest.zip

Fails with a large payload:

vagrant@buster64-dev-f6caca97:~/workspace/quictest$ dotnet run 200000
Waiting for remote stream reads closed
Unhandled exception. System.Net.Quic.QuicException: Operation aborted.
   at System.Net.Quic.ResettableValueTaskSource.TryComplete(Exception exception, Boolean final)
   at System.Net.Quic.QuicStream.HandleEventShutdownComplete(_SHUTDOWN_COMPLETE_e__Struct& data)
   at System.Net.Quic.QuicStream.HandleStreamEvent(QUIC_STREAM_EVENT& streamEvent)
   at System.Net.Quic.QuicStream.NativeCallback(QUIC_HANDLE* connection, Void* context, QUIC_STREAM_EVENT* streamEvent)
--- End of stack trace from previous location ---
   at Program.Main(String[] args) in /home/vagrant/workspace/quictest/Program.cs:line 64
   at Program.Main(String[] args) in /home/vagrant/workspace/quictest/Program.cs:line 69
   at Program.Main(String[] args) in /home/vagrant/workspace/quictest/Program.cs:line 69
   at Program.Main(String[] args) in /home/vagrant/workspace/quictest/Program.cs:line 69
   at Program.<Main>(String[] args)

Hangs with a small payload:

vagrant@buster64-dev-f6caca97:~/workspace/quictest$ dotnet run 10
Waiting for remote stream reads closed
^CAttempting to cancel the build...

Expected behavior

I expect the same behavior regardless of the payload size.

Actual behavior

It hangs with a small payload.

Regression?

No response

Known Workarounds

No response

Configuration

This occurs on Linux/Debian with .NET 7.0 RC1

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