Skip to content

bytes::BytesMut::extend_from_slice or mio::net::TcpSocket produces unexpected result #625

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

Closed
softstream-link opened this issue Aug 31, 2023 · 1 comment

Comments

@softstream-link
Copy link

softstream-link commented Aug 31, 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

  1. This has one example file called /examples/bytes_bug.rs

  2. 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.

  3. Post:
    bytes_bug - HackMD

It never fails on macOS

@softstream-link softstream-link closed this as not planned Won't fix, can't repro, duplicate, stale Aug 31, 2023
@softstream-link 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
@softstream-link
Copy link
Author

closing in favor of rust-lang/rust#115451

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

1 participant