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

split stream, what is latest status of feature unstable-split? #64

Open
so-schen opened this issue Feb 4, 2024 · 5 comments
Open

split stream, what is latest status of feature unstable-split? #64

so-schen opened this issue Feb 4, 2024 · 5 comments

Comments

@so-schen
Copy link

so-schen commented Feb 4, 2024

No description provided.

@so-schen so-schen changed the title split stream, what is latest status of unstable-split split stream, what is latest status of feature unstable-split? Feb 4, 2024
@mmastrac
Copy link
Contributor

mmastrac commented Feb 4, 2024

It's been in use in Deno for a few months now, I think and it's been stable. I'm not sure if we'll tweak the API in the future to make it a little more ergonomic, but the feature definitely works.

@so-schen
Copy link
Author

so-schen commented Feb 5, 2024

@mmastrac, by reading the impl, it seems to me the read frame is not Cancel safe. Am I correct?

@mmastrac
Copy link
Contributor

mmastrac commented Feb 5, 2024

I suspect if you are using automatic pong and automatic close, those methods are not cancellation-safe. We probably need to have a full poll-read/poll-write set of interfaces to ensure that.

@so-schen
Copy link
Author

so-schen commented Feb 5, 2024

FragmentCollector::read_frame() which use async fn parse_frame_header does not remember the read pointer, so if it is canceled in the middle, the data read from tcp stream will be forgotten in next call, because re-enter the read_frame, we start from read from index 0

I am not familiar with websocket wired-protocol, I wondering if this is potential risk

@BiagioFesta
Copy link

BiagioFesta commented Mar 27, 2024

FragmentCollector::read_frame() which use async fn parse_frame_header does not remember the read pointer, so if it is canceled in the middle, the data read from tcp stream will be forgotten in next call, because re-enter the read_frame, we start from read from index 0

I am not familiar with websocket wired-protocol, I wondering if this is potential risk

Definitely FragmentCollector::read_frame() is not cancel safe (regardless if automatic pong/close is set or not). If the future is cancelled the framing logic might be interrupted in the middle and, thus, next read will produce a protocol error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants