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

Windows named pipes hits unreachable code during read operation #1819

Open
akahan opened this issue Jul 27, 2024 · 8 comments
Open

Windows named pipes hits unreachable code during read operation #1819

akahan opened this issue Jul 27, 2024 · 8 comments

Comments

@akahan
Copy link

akahan commented Jul 27, 2024

The error occurs at this location:

_ => unreachable!(),

In io.read comes State::Err with: Err The pipe has been ended. (os error 109)
This appears on both Windows 11 and Windows 10.

It reproduced almost stably when closing the laptop lid with running service and client, apparently after switching to standby mode.

If I handle this state and simply exit the read_done method without calling unreachable (and assign the same error state to io.read again. Perhaps it's better not to do this?), everything continues to work, seemingly normal. Any comments guys?

My environment works like this:
The Windows service creates a named pipe as an administrator (both PipeMode::Bytes and PipeMode::Message modes were tested). After which the client connects to it and sends a message 2 times per second and reads the response.

@Thomasdezeeuw
Copy link
Collaborator

Maybe related to #1660?

@akahan what version of Mio are you running?

@akahan
Copy link
Author

akahan commented Jul 27, 2024

last version 1.0.1

@akahan
Copy link
Author

akahan commented Jul 27, 2024

Even if it's a similar bug #1660. In any case, it is not fixed.

@akahan
Copy link
Author

akahan commented Jul 27, 2024

I can not understand. If io.read | io.write state can be Err, why is it not checked here, but only Pending is checked, and the rest is supposedly unreachable?

@akahan
Copy link
Author

akahan commented Jul 27, 2024

Here https://github.com/akahan/mio/tree/v1.0.1-dev is the code that I used to temporarily solve this problem.

@sergioabreu-g
Copy link

I'm getting constant crashes in my application due to this, could akahan's fix be applied as it is? I've read the code but it's quite convoluted, I don't see why the Error state should be deemed unreachable at that point.

@Thomasdezeeuw
Copy link
Collaborator

@sergioabreu-g a pull request for this would be welcome.

@sergioabreu-g
Copy link

@sergioabreu-g a pull request for this would be welcome.

I can make a PR with that change but I don't know what the consequences might be. I don't have enough knowledge of the codebase to understand why that error is there or how it should be handled.

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