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

Fix uds listener hanging on accept #272

Merged
3 commits merged into from
Oct 7, 2019
Merged

Fix uds listener hanging on accept #272

3 commits merged into from
Oct 7, 2019

Conversation

mvucenovic
Copy link
Contributor

UDS listener was hanging because the accept method would return Poll::Pending without registering the task to be awoken in the case when underlying unix listener returns a WouldBlock that gets converted to None. This is a hacky fix for this case.

Should fix #248

UDS listener was hanging because the accept method would return
`Poll::Pending` without registering the task to be awoken in the case
when underlying unix listener returns a WouldBlock that gets converted
to None. This is a hacky fix for this case.

Should fix async-rs#248
@skade
Copy link
Collaborator

skade commented Oct 2, 2019

This would be great chance to cover this with a test case to avoid regressions. @mvucenovic, would you be able to find a case that exhibits the (previously broken) behaviour?

@mvucenovic
Copy link
Contributor Author

@skade Sure thing, I would like to write a bigger integration test that reproduces this issue, as I've mentioned in the #248. I won't be able to do this today, but will try to finish it before the weekend. I've submitted this PR early, because I consider this change a hacky one, so any suggestions how this should be done better are welcome.

@skade
Copy link
Collaborator

skade commented Oct 2, 2019

@mvucenovic Perfect 👍 thanks for letting me know!

This one should reproduce async-rs#248 bug to prevent further regressions.
@mvucenovic
Copy link
Contributor Author

Hey @skade, I've added a test that reproduces the listener hanging forever. For me it fails on the master, but passes on this branch.

Interesting thing, my first version of test was not running in two different threads, but used join macro, to run server and client concurrently, and that version was green on the current master. It looked something like this:

     // rest of the code is mostly the same
     task::block_on(async {
         let listener = UnixListener::bind(&socket).await.expect("Socket bind");

         let server = ping_pong_server(listener, iter_cnt);
         let client = ping_pong_client(&socket, iter_cnt);

         async_std::io::timeout(
             Duration::from_secs(5),
             async_std::future::try_join!(server, client),
         ).await
     }).expect("not finished successfully");

I'll try to investigate why was that the case, just wanted to mention if somebody has any idea.

@jD91mZM2
Copy link

jD91mZM2 commented Oct 6, 2019

Hi, sorry for the notification, I just wanted to say that I needed to use unix sockets and switching to your fork solved it for me, just like that. You're awesome! :)

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few nits. :) Thanks!

src/os/unix/net/listener.rs Outdated Show resolved Hide resolved
src/os/unix/net/listener.rs Outdated Show resolved Hide resolved
src/os/unix/net/listener.rs Outdated Show resolved Hide resolved
tests/uds.rs Outdated Show resolved Hide resolved
@ghost ghost closed this Oct 6, 2019
@ghost ghost reopened this Oct 6, 2019
@ghost
Copy link

ghost commented Oct 6, 2019

@skade @yoshuawuyts It seems Clippy checks are failing in this pull request. Should we make Clippy tests not required to pass in CI?

@yoshuawuyts
Copy link
Contributor

@stjepang the failure here was an upstream failure iirc that's now been fixed in actions-rs. Re-running the check should solve it. Clippy currently doesn't fail CI.

Additionally #270 should be landing soon now which means clippy errors should be resolved. This would allow us to then enable actions-rs/clippy-check#2 (comment) once it's implemented (if we so desire).

Anyway, going to restart the CI here which should fix the error!

@mvucenovic
Copy link
Contributor Author

Thanks for the review @stjepang, I've updated the PR with your suggestions.

@ghost
Copy link

ghost commented Oct 6, 2019

bors r+

@ghost ghost merged commit c3e3815 into async-rs:master Oct 7, 2019
This pull request was closed.
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.

unix sockets don't work since the 0.99.6 release
4 participants