-
Notifications
You must be signed in to change notification settings - Fork 2.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
WebSockets: TCP fragmentation needs to be handled #9052
Comments
5 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What version of Bun is running?
1.0.28+705638470
What platform is your computer?
No response
What steps can reproduce the bug?
This is a follow-up to #9027.
WebSockets are implemented using TCP (or Unix domain sockets). TCP has fragmentation. The WebSockets protocol also has fragmentation. They are distinct and happen at different layers. That confused me.
Our code currently does not handle TCP fragmentation for WebSockets connections. That's not usually a problem because TCP connections tend to send out each WebSockets frame in a new TCP packet. But sometimes it is, so it should be fixed.
This bug can be reproduced by running a WebSockets server which sends out each byte in an individual TCP packet, or simulating one by splitting the data after receiving it.
What is the expected behavior?
The expected behavior is that our WebSockets code handles all possible TCP fragmentation types, including single-byte packets for everything.
What do you see instead?
Using single-byte packets, in the client code, WS pings and pongs currently fail. I haven't tested the server code yet. Fragmentation that happens in the WS payload appears to be handled by the existing code.
Additional information
I'm testing code locally which fixes the client and will open a PR soon.
The text was updated successfully, but these errors were encountered: