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
{{ message }}
Repository navigation
Multicast demo fails with message "Can't assign requested address" #2423
I have searched the issues of this repository and believe that this is not a duplicate.
I have checked the FAQ of this repository and believe that this is not a duplicate.
Environment
Dubbo version: master branch
Operating System version: macOS 10.13.6
Java version: 1.8
Step to reproduce this issue
start the provider demo
Expected Result
Provider start success.
Actual Result
Provider start failed.
If there is an exception, please attach the exception trace:
Caused by: java.net.SocketException: Can't assign requested address
at java.net.PlainDatagramSocketImpl.join(Native Method)
at java.net.AbstractPlainDatagramSocketImpl.join(AbstractPlainDatagramSocketImpl.java:178)
at java.net.MulticastSocket.joinGroup(MulticastSocket.java:323)
at org.apache.dubbo.registry.multicast.MulticastRegistry.<init>(MulticastRegistry.java:91)
... 24 more
If I add vm args -Djava.net.preferIPv4Stack=true, everything works fine.
awdl0 is ipv6 only and en0 is both ipv4 and ipv6 available. However the JVM selects awdl0 as the default Network Interface in java.net.DefaultInterface#getDefault() method. So if we use a ipv4 address for multicasting, the error will occur.
If -Djava.net.preferIPv4Stack=true is specified, JVM will avoid choosing awdl0 as default network interface. So everything will be all right.
Enhancement
Basically we don't want to let user to specify that vm args manually, so I'd like to propose to automatically select network interface by the input multicast address.
If the multicast address is ipv4 address, automatically use ipv4 network address (by calling java.net.MulticastSocket#setInterface()), and vise versa.
Activity
ralf0131 commentedon Sep 2, 2018
This is because there are multiple network interfaces in my macOS, both for ipv4 and ipv6:
awdl0is ipv6 only anden0is both ipv4 and ipv6 available. However the JVM selectsawdl0as the default Network Interface injava.net.DefaultInterface#getDefault()method. So if we use a ipv4 address for multicasting, the error will occur.If
-Djava.net.preferIPv4Stack=trueis specified, JVM will avoid choosingawdl0as default network interface. So everything will be all right.Enhancement
Basically we don't want to let user to specify that vm args manually, so I'd like to propose to automatically select network interface by the input multicast address.
If the multicast address is ipv4 address, automatically use ipv4 network address (by calling
java.net.MulticastSocket#setInterface()), and vise versa.zonghaishang commentedon Sep 14, 2018
@ralf0131 When does this problem plan to fix?
ralf0131 commentedon Sep 17, 2018
No ETA yet :(
Do you have interest to take this?
Fix apache#2423, Multicast demo fails with message "Can't assign requ…
[Dubbo-2423] Multicast demo fails with message "Can't assign requeste…
Merge master branch to 3.x dev branch (#3718)