gvisor: rust http server cannot listen on port
I’m trying to run an http server written in Rust with this command:
docker run --init --runtime=runsc dgageot/rust
produces this error:
Starting web server v6
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ListenError { inner: Io(Os { code: 98, kind
: AddrInUse, message: "Address in use" }) }', libcore/result.rs:945:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.
P9 server returned error. Gofer is shutting down. FD: 7, err: EOF
no matter which port I use.
Here’s the code for the container:
extern crate shio;
use shio::prelude::*;
use shio::http::{Method};
fn hello_world(_: Context) -> Response {
Response::with("Hello from rust\n")
}
fn main() {
println!("Starting web server v6");
Shio::default()
.route((Method::GET, "/", hello_world))
.run(":8080")
.unwrap();
}
and the cargo descriptor:
[package]
name = "run"
version = "0.1.0"
authors = ["David Gageot <david@gageot.net>"]
[dependencies]
shio = "0.3.0"
it’s built with this command to produce a statically linked binary.
cargo build --release --target x86_64-unknown-linux-musl
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 15 (10 by maintainers)
@praveensastry I’m working on this right now.
its working with gvisor!!
The current status is we believe that we fixed the issue, but someone needs to verify that shio now works correctly in gVisor.