You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found this while investigating pre-cancelled writes for #32077
This might be a result of a race condition, because I can see exception being set to ResettableCompletionSource, but it is not propagated to Read call.
It reproduces for me on this
[Fact]publicasync Task StreamAbortedWithoutWriting_ReadThrows(){longexpectedErrorCode=1234;await RunClientServer(
clientFunction:async connection =>{awaitusingQuicStreamstream= connection.OpenUnidirectionalStream(); stream.AbortWrite(expectedErrorCode);await stream.ShutdownCompleted();},
serverFunction:async connection =>{awaitusingQuicStreamstream=await connection.AcceptStreamAsync();byte[]buffer=newbyte[1];// this assert fails (no exception was thrown)QuicStreamAbortedExceptionex=await Assert.ThrowsAsync<QuicStreamAbortedException>(()=> ReadAll(stream, buffer)); Assert.Equal(expectedErrorCode, ex.ErrorCode);await stream.ShutdownCompleted();});}
If I write anything to stream before aborting it, exception is thrown as expected.
I have just reproduced it after writing too.
I suspect it might be fixed by #52929 because @scalablecory mentioned fixing some race conditions for read state.
The text was updated successfully, but these errors were encountered:
Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.
Issue Details
I found this while investigating pre-cancelled writes for #32077
This might be a result of a race condition, because I can see exception being set to ResettableCompletionSource, but it is not propagated to Read call.
It reproduces for me on this
[Fact]publicasync Task StreamAbortedWithoutWriting_ReadThrows(){longexpectedErrorCode=1234;await RunClientServer(
clientFunction:async connection =>{awaitusingQuicStreamstream= connection.OpenUnidirectionalStream(); stream.AbortWrite(expectedErrorCode);await stream.ShutdownCompleted();},
serverFunction:async connection =>{awaitusingQuicStreamstream=await connection.AcceptStreamAsync();byte[]buffer=newbyte[1];// this assert fails (no exception was thrown)QuicStreamAbortedExceptionex=await Assert.ThrowsAsync<QuicStreamAbortedException>(()=> ReadAll(stream, buffer)); Assert.Equal(expectedErrorCode, ex.ErrorCode);await stream.ShutdownCompleted();});}
If I write anything to stream before aborting it, exception is thrown as expected.
I suspect it might be fixed by #52929 because @scalablecory mentioned fixing some race conditions for read state.
CarnaViire
changed the title
[QUIC] No exception on read if peer aborted stream without writing to it
[QUIC] QuicStreamAbortedException sometimes is not thrown
Jun 2, 2021
I found this while investigating pre-cancelled writes for #32077
This might be a result of a race condition, because I can see exception being set to ResettableCompletionSource, but it is not propagated to Read call.
It reproduces for me on this
If I write anything to stream before aborting it, exception is thrown as expected.I have just reproduced it after writing too.
I suspect it might be fixed by #52929 because @scalablecory mentioned fixing some race conditions for read state.
The text was updated successfully, but these errors were encountered: