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

Bela Ban (JIRA) issues at jboss.org
Tue Mar 11 03:59:10 EDT 2014


    [ https://issues.jboss.org/browse/JGRP-1254?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12951820#comment-12951820 ] 

Bela Ban commented on JGRP-1254:
--------------------------------

The code for catching IOExceptions has been removed in JGRP-1765 as we're now using the DatagramSocket to send multicasts
                
> Fix NoRouteToHost exception in UDP._send()
> ------------------------------------------
>
>                 Key: JGRP-1254
>                 URL: https://issues.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.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list