-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
Relocate webtransport streams initialisation from HTTP3 connection accept loop to streams type #55425
base: main
Are you sure you want to change the base?
Conversation
…loop to streams type
Thanks for your PR, @AliKhalili. Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
@@ -245,6 +254,48 @@ private async ValueTask<long> TryReadStreamHeaderAsync() | |||
} | |||
} | |||
|
|||
private async ValueTask<long> TryReadWebTransportStreamSessionIdAsync() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a function with identical implementation in both Control and Request Streams; struggling to find an ideal location
private async ValueTask<long> TryReadWebTransportStreamSessionIdAsync() | ||
{ | ||
// https://ietf-wg-webtrans.github.io/draft-ietf-webtrans-http3/draft-ietf-webtrans-http3.html#section-4.1-1 | ||
while (_isClosed == 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_isClosed
is declared as volatile
. Writes to it are done via Interlocked.Exchange
, so I'd prefer if the reads are done via Volatile.Read
(explicitly).
It makes the code also easier to read / follow, as it's clear the memory-ordering is considered.
The same on other places where _isClosed
is read.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your review, that's a genuine concern and I noticed that. However, the current implementation(Http3ControlStream) doesn't use the Volatile.Read
method as you said, and I didn't want to alter any implementation conventions to avoid submitting a PR with numerous changes. I'm happy to address that though.
SequencePosition start = default; | ||
try | ||
{ | ||
while (_isClosed == 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here _isClosed
isn't declared as volatile
, so it should be Volatile.Read
s and writes (L96)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, in Http3Stream
it's not defined as volatile, and I believe we should treat them the same way and make it volatile as well in Http3Stream
.
Looks like this PR hasn't been active for some time and the codebase could have been changed in the meantime. |
Hi @amcasey, Any update on when this PR might be looked at would be appreciated. Thank you! |
@AliKhalili Sorry for the delay - I've been out sick. I'm starting to work through my backlog of reviews, but I'm not entirely recovered. |
@amcasey sorry to hear that. I hope you have a speedy recovery. Don't worry, I'm not in a rush at all. |
Relocate webtransport streams initialisation from HTTP3 connection accept loop to streams type
Description
This PR aims to remove all
webtransport
stream initialisation from theHttp3Connection
accept loop and relocate them to the appropriate location within stream types. Unidirectional streams will be transitioned to theControlStream
, responsible for managing Unidirectional streams. Additionally, Bidirectional streams will be moved to theRequestStream
, functioning similarly to theControlStream
by reading the stream header and executing the proper method to handle incoming streams.With this PR, I've tried to resolve the performance issue highlighted in the #42789. Considering this comment as a guideline, the current implementation of webtransport is based on draft02. Before updating to the latest draft version of webtransport (version 09), addressing the current implementation issues would facilitate any upcoming changes.
I also made efforts to adhere to existing code base conventions and avoid introducing significant changes. As a side effect of this relocation from connection to streams, we no longer need to manage pending streams. This PR also removes all pending stream-related stuff. Your feedback on these modifications is highly appreciated to ensure the refinement and appropriateness of the code.
Fixes #42789