OSError: [Errno 99] Cannot assign requested address

Feng Li
1 min readApr 22, 2022

--

This error is seen when tornado tries to bind IP/port when Jupyter Enterprise Gateway starts.

jupyter-enterprisegateway --ip=hostname.domain.com

It’s complaining about something wrong with the IP address instead of the port. What is the “requested address” JEG wants to bind?

We’re using strace to look at details. As we know strace provides overwhelming messages so we can add “qualifier” to filter messages we want to focus. To do so we use “-e” as follows:

strace -f -e trace=bind jupyter-enterprisegateway --ip=hostname.domain.com

And we can find two bind system calls


bind(6, (sa_family-AF_INET, sin_port-htons(8888), sin_addr-inet_addr(“10.0.0.10”)), 16) = 0
bind(7, (sa_family-AF_INET6, sin6_port-htons(8888), inet_pton(AF_INET6, “1111:222:3333:444::5:6666”, &sin6_addr), sin6_flowinfo-hton(0), sin6_scope_id=0),28) = -1 EADDRNOTAVAIL (Cannot assign requested address)
….

It seems first bind succeeded for IPv4 and second failed for IPv6.

Further look at /etc/hosts - there are two entries for the hostname

10.0.0.10 hostname.domain.com
1111:222:3333:444::5:6666 hostname.domain.com

Hmm…what wrong with this IPv6 address? Let’s check network interfaces…

# ip a
...
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 00:00:0a:1f:2b:6e brd ff:ff:ff:ff:ff:ff
inet 10.0.0.10/16 brd 10.31.63.255 scope global dynamic noprefixroute eth0
valid_lft 26809sec preferred_lft 26809sec

Somehow we don’t see there is a IPv6 address configured in the system! So it’s the /etc/hosts file has been messed up.

Get rid of the IPv6 address in /etc/hosts will be able to resolve this issue.

Happy Reading!

--

--

Feng Li

Software Engineer, playing with Snowflake, AWS and Azure. Snowflake Data Superhero 2024. SnowPro SME, Jogger, Hiker. LinkedIn: https://www.linkedin.com/in/fli01