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

Bugfix: Mio not blocking #17

Merged
merged 2 commits into from Jul 13, 2019
Merged

Bugfix: Mio not blocking #17

merged 2 commits into from Jul 13, 2019

Conversation

vorner
Copy link
Owner

@vorner vorner commented Jul 13, 2019

@howaboutsynergy: This should fix the problem you reported (#16). Would you like to try it out yourself before I release it?

When the mio-support feature is enabled, it doesn't block on .wait :-(.

Reproducer for #16.
@ghost
Copy link

ghost commented Jul 13, 2019

it works, with the following change:

diff --git a/src/lib.rs b/src/lib.rs
index ff2dd18..2cb12cc 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -125,8 +125,8 @@ extern crate futures;
 extern crate libc;
 #[cfg(feature = "mio-support")]
 extern crate mio;
-#[cfg(feature = "mio-support")]
-extern crate mio_uds;
+//#[cfg(feature = "mio-support")]
+//extern crate mio_uds;
 extern crate signal_hook_registry;
 #[cfg(feature = "tokio-support")]
 extern crate tokio_reactor;

Thank you for fixing this.

PS: this passed too: cargo test --all --all-features

The problem was, when the feature was enabled, the wakeup socket got
switched to non-blocking mode (no matter if anything mio-related was
actually used). So things that should have been blocking didn't and it
was retrying the read from the pipe in a tight loop.

Now we don't switch to non-blocking, but use the MSG_DONTWAIT flag when
we need non-blocking read.

Closes #16
@vorner
Copy link
Owner Author

vorner commented Jul 13, 2019

Thanks, great to hear it works :-).

it works, with the following change:

I wonder how came the tests were green without this change :-|.

@vorner vorner merged commit 5cd4bc0 into master Jul 13, 2019
@vorner vorner deleted the mio-not-blocking branch July 13, 2019 16:33
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

Successfully merging this pull request may close these issues.

None yet

1 participant