Bug 40042 - When mcastBindAddress is set and disabling/enabling interface on Win get infinite NoRouteToHostException
When mcastBindAddress is set and disabling/enabling interface on Win get infi...
Status: RESOLVED FIXED
Product: Tomcat 5
Classification: Unclassified
Component: Catalina:Cluster
5.5.16
Other other
: P2 major (vote)
: ---
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2006-07-14 00:36 UTC by David Gagnon
Modified: 2009-07-12 14:15 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Gagnon 2006-07-14 00:36:13 UTC
Hi,

  I'm doing some test for an HA solution with Tomcat and run into this problem.


 <Membership
                        className="org.apache.catalina.cluster.mcast.McastService"
                        mcastAddr="228.0.0.6" mcastBindAddress="onyx.webos2.net"
                        mcastPort="45564"
                        mcastFrequency="500"
                        mcastDropTime="3000"/>

When mcastBindAddress is specified and the network card is disabled/Enabled I get 

ATTENTION: Unable to send mcast message.
java.net.BindException: Cannot assign requested address: Datagram send failed
	at java.net.PlainDatagramSocketImpl.send(Native Method)
	at java.net.DatagramSocket.send(Unknown Source)
	at
org.apache.catalina.cluster.mcast.McastServiceImpl.send(McastServiceImpl.java:238)
	at
org.apache.catalina.cluster.mcast.McastServiceImpl$SenderThread.run(McastServiceImpl.java:274)
2006-07-13 20:29:00
org.apache.catalina.cluster.mcast.McastServiceImpl$SenderThread run
ATTENTION: Unable to send mcast message.
java.net.NoRouteToHostException: No route to host: Datagram send failed
	at java.net.PlainDatagramSocketImpl.send(Native Method)
	at java.net.DatagramSocket.send(Unknown Source)
	at
org.apache.catalina.cluster.mcast.McastServiceImpl.send(McastServiceImpl.java:238)
	at
org.apache.catalina.cluster.mcast.McastServiceImpl$SenderThread.run(McastServiceImpl.java:274)


The problem is that the NoRouteToHost loop forever.

If I omit the mcastBindAddress param I will get a NoRouteToHostException and
Tomcat will continue correctly when the interface is up again.

Best Regards
David
Comment 1 Filip Hanik 2006-07-14 02:11:27 UTC
When you enable the route again, does it correct itself, or do you require a
tomcat restart.

I have a feeling that code needs to better self heal itself, but wanted to get
your input first.

Filip
Comment 2 Filip Hanik 2007-08-17 15:21:37 UTC
I've added a fix to Tomcat 6.0 and 6.x (in trunk).
Basically, it does attempt a recovery after such a failure.
There are still a few issues to work through, one of them being, what should be
done to the existing membership, since we are not receiving mcast packets due to
a local error, then is it really appropriate to expire members?
Comment 3 Peter Rossbach 2007-08-19 14:10:08 UTC
I have backport the Filips fix from tomcat 6.0.x.
It works for me at my MAC's, but I am not sure that it also work with other OS's.

Feedback is very welcome
Peter

- At my mac (jdk 1.5.0_07) I see some SocketTimeoutException and IOException after send is going 
wrong. After four failures the kernel create a new multicast route! Strange... After interface is back
the old route is recreated. 
Comment 4 Mark Thomas 2009-07-12 14:15:35 UTC
No feedback so assume Peter's backport did indeed work.