Skip to content

unix sockets don't work since the 0.99.6 release #248

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
dvc94ch opened this issue Sep 27, 2019 · 2 comments · Fixed by #272
Closed

unix sockets don't work since the 0.99.6 release #248

dvc94ch opened this issue Sep 27, 2019 · 2 comments · Fixed by #272
Labels
bug Something isn't working

Comments

@dvc94ch
Copy link

dvc94ch commented Sep 27, 2019

Expected behaviour:

loop
connected
loop

Actual behaviour:

loop

server.rs

use async_std::prelude::*;
use async_std::os::unix::net::UnixListener;
use async_std::task;

async fn run() {
    let socket = UnixListener::bind("/tmp/test.sock").await.expect("bind");
    let mut incoming = socket.incoming();
    loop {
        println!("loop");
        if let Some(stream) = incoming.next().await {
            println!("connected");
        }
    }
}

fn main() {
    task::block_on(run());
}

client.rs

use async_std::task;
use async_std::prelude::*;
use async_std::os::unix::net::UnixStream;

async fn run() {
    let mut socket = UnixStream::connect("/tmp/test.sock").await.expect("connect");
    socket.write_all(b"hello world").await.expect("write");
    socket.flush().await.expect("flush");
}

fn main() {
    task::block_on(run());
}
@yoshuawuyts yoshuawuyts added the bug Something isn't working label Sep 27, 2019
@zvkemp
Copy link
Contributor

zvkemp commented Sep 29, 2019

Git bisect points to d25dae5

@mvucenovic
Copy link
Contributor

Hey @stjepang, @yoshuawuyts I hope you don't mind me taking a stab at this.

I've debugged this issue (thanks @dvc94ch for the code that reproduces it), and I think I've found the cause of the bug, but my solution for it is short and hacky, so I need some guidance from you guys. I'll send a PR so you can take a look.

Also, I would like to add a bigger integration test that would cover this issue for the future, if you are okay with that.

mvucenovic pushed a commit to mvucenovic/async-std that referenced this issue Oct 2, 2019
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
mvucenovic pushed a commit to mvucenovic/async-std that referenced this issue Oct 2, 2019
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
mvucenovic pushed a commit to mvucenovic/async-std that referenced this issue Oct 3, 2019
This one should reproduce async-rs#248 bug to prevent further regressions.
mvucenovic pushed a commit to mvucenovic/async-std that referenced this issue Oct 3, 2019
This one should reproduce async-rs#248 bug to prevent further regressions.
@ghost ghost closed this as completed in #272 Oct 7, 2019
ghost pushed a commit that referenced this issue Oct 7, 2019
* Fix uds listener hanging on accept

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

* Test simulating uds ping-pong server/client

This one should reproduce #248 bug to prevent further regressions.

* Code review fixes
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants