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
Ok, so I have extracted a "minimum" amount of code to replicate it and posted it on HackMD with details of cargo toml and actual error message. This is quite a bit of code to go thought but here is the overall structure
This has one example file called /examples/bytes_bug.rs
The file has two #[test]'s so you can run each one independently
a) test 1
called test_emulated() and it writes a fixed size, random bytes frame but arbitrarily splitting it in "half" and then tries to reconstruct the frame but checking if enough bytes are available in the bytes::BytesMut buffer. It seems to never fail on either linux or Mac
b) test 2
called test_socket() and this test has two thread
a new thread which runs server socket, it will read bytes and try to reassemble and count frames.
the main thread has a client socket and will write N frames, N has to be set pretty high, to get a failure.
Note: in this test, both read_frame & write_frame take place via a helper struct which will indicate whether io operation completed or socket was not ready. This is due to socket being intentionally non-blocking.
softstream-link
changed the title
extend_from_slice produces unexpected result
bytes::BytesMut::extend_from_slice or mio::net::TcpSocket produces unexpected result
Sep 1, 2023
Ok, so I have extracted a "minimum" amount of code to replicate it and posted it on HackMD with details of cargo toml and actual error message. This is quite a bit of code to go thought but here is the overall structure
This has one example file called /examples/bytes_bug.rs
The file has two #[test]'s so you can run each one independently
a) test 1
called test_emulated() and it writes a fixed size, random bytes frame but arbitrarily splitting it in "half" and then tries to reconstruct the frame but checking if enough bytes are available in the bytes::BytesMut buffer. It seems to never fail on either linux or Mac
b) test 2
called test_socket() and this test has two thread
a new thread which runs server socket, it will read bytes and try to reassemble and count frames.
the main thread has a client socket and will write N frames, N has to be set pretty high, to get a failure.
Note: in this test, both read_frame & write_frame take place via a helper struct which will indicate whether io operation completed or socket was not ready. This is due to socket being intentionally non-blocking.
Post:
bytes_bug - HackMD
It never fails on macOS
The text was updated successfully, but these errors were encountered: