Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP/3: QuicStream.ReadAsync ignores abort? #55056

Closed
JamesNK opened this issue Jul 2, 2021 · 7 comments
Closed

HTTP/3: QuicStream.ReadAsync ignores abort? #55056

JamesNK opened this issue Jul 2, 2021 · 7 comments

Comments

@JamesNK
Copy link
Member

JamesNK commented Jul 2, 2021

I have a server-to-client unidirectional stream. The server aborts its stream with AbortWrite(Error)

The client stream then calls ReadAsync and it returns a read count of 0. This is unexpected. Usually, a read count of 0 indicates successfully reading to the end of the stream. I expected an aborted exception instead.

When I look at the client stream's internal state I can see that it received the error code (ReadErrorCode):

image

Is this intended? I haven't tested whether this happens in other stream scenarios (client-to-server bidirectional and client-to-server unidirectional).

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Jul 2, 2021
@ghost
Copy link

ghost commented Jul 2, 2021

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

I have a server-to-client unidirectional stream. The server aborts its stream with:

_stream.AbortRead(Error);
_stream.AbortWrite(Error);

(AbortRead call is probably unnecessary, but I'm guessing it's not the cause of this issue)

The client stream then calls ReadAsync and returns 0 (which usually indicates successfully reading to the end of the stream). I expected an aborted exception instead.

When I look at the client stream's internal state I can see that it received the error code (ReadErrorCode):

image

Is this intended?

Author: JamesNK
Assignees: -
Labels:

area-System.Net.Quic

Milestone: -

@JamesNK
Copy link
Member Author

JamesNK commented Jul 2, 2021

stream.ReadAsync does throw QuicStreamAbortedException for client-to-server unidirectional stream on AbortWrite.

Is the bug unique to reading from server-to-client unidirectional streams?

@ManickaP ManickaP removed the untriaged New issue has not been triaged by the area owner label Jul 2, 2021
@ManickaP ManickaP added this to the 6.0.0 milestone Jul 2, 2021
@ManickaP
Copy link
Member

ManickaP commented Jul 2, 2021

This should work as you say, we should investigate and fix that.

Haven't we done some work in handling aborts for ReadAsync? cc: @CarnaViire

@wfurt
Copy link
Member

wfurt commented Jul 2, 2021

This may be fixed with #54798 as we set _canRead to false so ReadAsync will throw.
We should probably add explicit test and agree that the InvalidOperationException is good enough (or we should be smarter about exception type)

@JamesNK
Copy link
Member Author

JamesNK commented Jul 2, 2021

This might be a duplicate of #53530

@JamesNK
Copy link
Member Author

JamesNK commented Jul 4, 2021

This is a race condition. The test correctly threw QuicStreamAbortedException once.

@ManickaP
Copy link
Member

ManickaP commented Jul 6, 2021

Duplicate of #53530

@ManickaP ManickaP marked this as a duplicate of #53530 Jul 6, 2021
@ManickaP ManickaP closed this as completed Jul 6, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Aug 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants