You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
rust: support and default to --host localhost (#4804)
Summary:
We now interpret `--host` as a string that can be `getaddrinfo`d rather
than requiring it to be a literal IP address. Thus, we can support
hostnames like `localhost` that [may have multiple resolutions][play]:
```
[src/main.rs:3] ("localhost", 6006).to_socket_addrs().unwrap().collect::<Vec<_>>() = [
127.0.0.1:6006,
[::1]:6006,
]
```
[play]: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=15504b49f87e983b4748ca976dcb3bd1
Thus, we change the default `--host` from `::1` to `localhost` to
support systems where `::1` may not be available. Should fix#4801.
We also improve the error message on bind failure: it’s pretty-printed
instead of `Debug`-formatted, and it includes the problematic address.
Test Plan:
From `tensorboard/data/server/`, run `cargo build`, then reproduce the
failure in Docker:
```
$ img=tensorflow/tensorflow@sha256:31775f136e5fe2d50ae075100dff335e9ae0954b8f9b529791a8bf739f3dd415
$ v="$PWD/target/debug:/rustboard-bin:ro"
$ docker run --rm -it -v "$v" "$img" /rustboard-bin/rustboard --logdir /tmp --host ::1
fatal: failed to bind to ("::1", 6806): Cannot assign requested address (os error 99)
```
…then try again with default `--host` and note that it works:
```
$ docker run --rm -it -v "$v" "$img" /rustboard-bin/rustboard --logdir /tmp
listening on 127.0.0.1:6806
```
(You may need to `docker kill $(docker ps -q)` the thing afterward.)
wchargin-branch: rust-host-getaddrinfo
0 commit comments