-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Gurkan,

On Thursday, May 30th, 2019, Gurkan Erdogdu
<gurkanerdo...@yahoo.com.INVALID> wrote:
> 
> In  macOS test server, when configuring the mcastBindAddress as 
> 192.168.1.139 and address as 228.0.0.4 , the code does not use 
> mcastBindAddress , instead it uses multicast  address for socket
> binding and throws exception when sending the datagram packet. Here
> is the exception:
> 
> Exception in thread "main"
> org.apache.catalina.tribes.ChannelException: java.io.IOException:
> Can't assign requested address (sendto failed); No faulty members
> identified. at
> org.apache.catalina.tribes.group.ChannelCoordinator.internalStart(Chan
nelCoordinator.java:207)
>
> 
at
org.apache.catalina.tribes.group.ChannelCoordinator.start(ChannelCoordin
ator.java:111)
> at
> org.apache.catalina.tribes.group.ChannelInterceptorBase.start(ChannelI
nterceptorBase.java:165)
>
> 
at
org.apache.catalina.tribes.group.interceptors.MessageDispatchInterceptor
.start(MessageDispatchInterceptor.java:228)
> at
> org.apache.catalina.tribes.group.ChannelInterceptorBase.start(ChannelI
nterceptorBase.java:165)
>
> 
at
org.apache.catalina.tribes.group.GroupChannel.start(GroupChannel.java:48
3)
> at test.MemberShipTest.main(MemberShipTest.java:44) Caused by:
> java.io.IOException: Can't assign requested address (sendto
> failed) at java.net.PlainDatagramSocketImpl.send(Native Method) at
> java.net.DatagramSocket.send(DatagramSocket.java:693) at
> org.apache.catalina.tribes.membership.McastServiceImpl.send(McastServi
ceImpl.java:505)
>
> 
at
org.apache.catalina.tribes.membership.McastServiceImpl.send(McastService
Impl.java:482)
> at
> org.apache.catalina.tribes.membership.McastServiceImpl.start(McastServ
iceImpl.java:268)
>
> 
at
org.apache.catalina.tribes.membership.McastService.start(McastService.ja
va:289)
> at
> org.apache.catalina.tribes.group.ChannelCoordinator.internalStart(Chan
nelCoordinator.java:196)
>
> 
... 6 more
> 
> When I changed the address to mcastBindAddress while creating the
> socket, no more exception occurred.

I wonder if the problem is that everyone uses multicast on Linux (or
Windows?) and nobody noticed that the code was wrong for the
non-Linux(/Windows?) case. There is this note in setupSocket:

203     if (mcastBindAddress != null) {
204         try {
205             log.info(sm.getString("mcastServiceImpl.bind",
address, Integer.toString(port)));
206             socket = new MulticastSocket(new
InetSocketAddress(address,port));
207         } catch (BindException e) {
208             /*
209              * On some platforms (e.g. Linux) it is not possible
to bind
210              * to the multicast address. In this case only bind to t
he
211              * port.
212              */
213             log.info(sm.getString("mcastServiceImpl.bind.failed"));
214             socket = new MulticastSocket(port);
215         }
216     } else {
217         socket = new MulticastSocket(port);
218     }

So either nobody ever sets the mcastBindAddress, or nobody uses a
system where is actually uses that address.

I'd accept the patch as proposed, or a PR with your name on it, but I
don't have a good place to test it in other environments. Can you file
a BZ issue or make a pull-request with your changes? Others with
better familiarity with the multicast clustering can give it a better
review.

Could you write a unit-test for it?

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlzwHWQACgkQHPApP6U8
pFgHkxAAxqNGrVLq6G0NahXhKSYLcyF9X5OGv0bMjqg7DjFyOqAJK5X4NKpCqgox
6QUZRoS+3GWMv+uJYd8nQvV3/UBOFboD7NqKnrvgPOSTIG4IPCgp18aLec6+7W/C
mb9DfPqiANVKim5TxY7a+XctNYyN+3Rh0Zxy60SRnR4qJBzztbHBKBJlSHLgwNiG
/LGhmYlDbtOFQVuYOji4CRP3y4XnQ6LvhVLhwsbZ2q+NS0G5u2iQH3wo1fqbbFcQ
InKL2rFQJUBRQOla2f6nF8moedeEFtGbr19N8+2PqJPLJUmiBWkJhjepl/PBMvT8
rT1XUtfYMYUzByD1QwZI9SnX+HpwWn32uTue369+wsAzXMULwwlDgIuGVhIog5CV
UmU2MKWGpglWCWJK0UejV5xkhjzsdLxJD2a6RrNY8y683dL/PqwppGyGxI6uo9Ja
9Qe6MpM+qvAZHp1/7hB+KgH03HmLxXRBSl2DZbcVjmmQGhKTh3AHiI/D/8mrk8Ny
YqmkmWNTt4gTBPP9A3OQJYTsbV3MQBsLqyheYHquaHiLVdOsN9bfrXNfAV3bk9Ni
lxOE4LjAHwpXRALwtD+i3E1wGCjfeAqwMYxxZyHZGU6HXrQynQJITb11rhwo+NUN
y1615lCjNw076+bv67w3H4tjc8eewsNGPU5+8Uipq+2iXfe/pVU=
=f3l5
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to