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

Broken pipe error while flushing data that has been read #6

Open
geigerzaehler opened this issue Jul 2, 2020 · 0 comments
Open

Broken pipe error while flushing data that has been read #6

geigerzaehler opened this issue Jul 2, 2020 · 0 comments

Comments

@geigerzaehler
Copy link
Contributor

The following test results in a BrokenPipe error in writer.write_all although all data has been read.

#[tokio::test]
async fn drop_read_exact() {
    let (mut writer, mut reader) = pipe();

    let write_handle = tokio::spawn(async move {
        writer.write_all(&mut [0u8; 8]).await.unwrap();
    });

    let mut buf = [0u8; 8];
    reader.read_exact(&mut buf).await.unwrap();
    drop(reader);
    write_handle.await.unwrap();
}

I’m looking into how to fix this.

geigerzaehler pushed a commit to geigerzaehler/async-pipe-rs that referenced this issue Jul 2, 2020
This change fixes panics (routerify#6) and unsafe code (routerify#5). This comes at the
cost of an additional copy of the data send through the pipe and having
a buffer in the state.

Moreover all unsafe code is removed and the need for a custom `Drop`
implementation which makes the code overall easier.

We also add tests.
geigerzaehler pushed a commit to geigerzaehler/async-pipe-rs that referenced this issue Jul 2, 2020
This change fixes panics (routerify#6) and unsafe code (routerify#5). This comes at the
cost of an additional copy of the data send through the pipe and having
a buffer in the state.

Moreover all unsafe code is removed and the need for a custom `Drop`
implementation which makes the code overall easier.

We also add tests.
ttiurani pushed a commit to ttiurani/async-pipe-rs that referenced this issue Oct 25, 2020
This change fixes panics (routerify#6) and unsafe code (routerify#5). This comes at the
cost of an additional copy of the data send through the pipe and having
a buffer in the state.

Moreover all unsafe code is removed and the need for a custom `Drop`
implementation which makes the code overall easier.

We also add tests.
geigerzaehler pushed a commit to geigerzaehler/async-pipe-rs that referenced this issue Jul 26, 2021
This change fixes panics (routerify#6) and unsafe code (routerify#5). This comes at the
cost of an additional copy of the data send through the pipe and having
a buffer in the state. All unsafe code is removed and the need for a
custom `Drop` implementation which makes the code overall easier.

We also provide an implementation for traits from `futures` which is
behind a feature flag.

We also add tests.
geigerzaehler pushed a commit to geigerzaehler/async-pipe-rs that referenced this issue Jul 28, 2021
This change fixes panics (routerify#6) and unsafe code (routerify#5). This comes at the
cost of an additional copy of the data send through the pipe and having
a buffer in the state. All unsafe code is removed and the need for a
custom `Drop` implementation which makes the code overall easier.

We also provide an implementation for traits from `futures` which is
behind a feature flag.

We also add tests.
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