[jboss-jira] [JBoss JIRA] Created: (JGRP-1254) Fix NoRouteToHost exception in UDP._send()

Bela Ban (JIRA) jira-events at lists.jboss.org
Thu Nov 25 07:17:59 EST 2010


Fix NoRouteToHost exception in UDP._send()
------------------------------------------

                 Key: JGRP-1254
                 URL: https://jira.jboss.org/browse/JGRP-1254
             Project: JGroups
          Issue Type: Bug
            Reporter: Bela Ban
            Assignee: Bela Ban
             Fix For: 2.6.18, 2.11.1, 2.12


We did the same test with Weblogic and it is able to reconnect after a network failure.

I had a quick look at the code of JGroups and I think that we can override this limit by a minor modification. It is not necessary to recreate a socket in case of the raise of an NoRouteToHostException, we can bind the socket to the interface. I've modified the code to catch the NoRouteToHostException and now my cluster works well and JBoss and reconnect properly.

I've modified the _send method of UDP class like this :
org.jgroups.protocols.UDP._send :

private void _send(InetAddress dest, int port, boolean mcast, byte[] data, int offset, int length) throws Exception {
        DatagramPacket packet=new DatagramPacket(data, offset, length, dest, port);
        try {
            if(mcast) {
                if(mcast_send_sockets != null) {
                    MulticastSocket s;
                    for(int i=0; i < mcast_send_sockets.length; i++) {
                        s=mcast_send_sockets[i];
                        try {
                            s.send(packet);
                        }
                        // solve reconnection issue with Windows
                        catch(NoRouteToHostException e){
                            log.warn(e.getMessage() +", reset interface");
                            s.setInterface(s.getInterface());
                        }
                        catch(Exception e) {
                            log.error("failed sending packet on socket " + s);
                        }
                    }
                }
                else { // DEFAULT path
                    if(mcast_sock != null) {
                        try {
                            mcast_sock.send(packet);
                        }
                        // solve reconnection issue with Windows
                        catch(NoRouteToHostException e){
                            log.warn(e.getMessage() +", reset interface");
                            mcast_sock.setInterface(mcast_sock.getInterface());
                        }
                    }
                }
            }
            else {
                if(sock != null)
                    sock.send(packet);
            }
        }
        catch(Exception ex) {
            throw new Exception("dest=" + dest + ":" + port + " (" + length + " bytes)", ex);
        }
    }


-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list