Cannot use alternative port

When I configure:

listen = [::]:1966                                                                                             

Stargazer says:

ERROR - Address already in use (os error 98)

lsof shows noone is listening on port 1966. (There is another Gemini server on port 1965.)

Assigned to
4 months ago
3 months ago
Bug Merged

~bortzmeyer 4 months ago

Apparently, stargazer conflicts with itself. If I listen only on [::]:1966, it works. Whether this will have the intended effect (listening both with IPv4 and IPv6) depends on the OS.

~zethra 4 months ago

What OS are you using? I assume Linux. After doing some research I believe the problem is that by default in Rust on Linux, when listening on IPv6 it also listens on IPv4 and I'm not hanging that case.

~zethra 4 months ago

Could you try only listening on IPv6 and see if it listens on both?

~bortzmeyer 4 months ago

Yes, it is Linux. If I listen on IPv6 it works with both v4 and v6 but it is configurable. It is probably not because of Rust but it is a kernel choice, configurable with sysctl net/ipv6/bindv6only. In my case (it is the default on Debian):

% cat /proc/sys/net/ipv6/bindv6only 

This is why it works. This is a painful problem because it means the result of a given configuration file will depend on the system. I don't know for Rust but Go https://github.com/golang/go/issues/679 had a similar issue.

~zethra 4 months ago

I'll probably need another library to fix this (net2 I think). The way stargazer should behave is that if you have only IPv6 specified it should do whatever the system is configured to do. But if you have both specified in your config it should always do both. You think that's responsible? Or should I always set IPv6 only if only IPv6 is specified in the config?

~bortzmeyer 4 months ago

With the last version of stargazer (which apparently binds only on IPv6 when you give it [::], it works, I can have both and [::] on the same port, which seems sensible to me. Thanks.

~zethra REPORTED FIXED 3 months ago

Register here or Log in to comment, or comment via email.