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

Failed to listen on 127.0.0.1 with tokio #538

Closed
CfirTsabari opened this issue May 24, 2020 · 1 comment
Closed

Failed to listen on 127.0.0.1 with tokio #538

CfirTsabari opened this issue May 24, 2020 · 1 comment

Comments

@CfirTsabari
Copy link
Contributor

when using tide with tokio.

#[tokio::main]
async fn main() -> Result<(), std::io::Error> {
    let mut app = tide::new();
    app.at("/").get(|_| async { Ok("Hello, world!") });
    app.listen("127.0.0.1:8090").await?;
    Ok(())
}

and when trying to access it I get the connection stuck

❯ curl http://127.0.0.1:8090/

working with async-std solve the problem,
listening to localhost instead of 127.0.0.1 should also solve this

[dependencies]
tokio = { version = "0.2", features = ["full"] }
tide = "0.8.0"
❯ cargo --version
cargo 1.43.0 (2cbe9048e 2020-05-03)
❯ rustc --version
rustc 1.43.1 (8d69840ab 2020-05-04)
@yoshuawuyts
Copy link
Member

Thanks for raising this @CfirTsabari. Odd, yeah I ran into something similar this week. I couldn't quite pinpoint the root cause of the error, but it seems like Tokio isn't particularly happy to run sockets it didn't create.

We'll have to continue monitoring what we can do here (possibly async-rs/async-std#804 can help), but for now I think there's nothing more we can do right here. Thanks for sharing what you did to resolve it!

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

2 participants