[jboss-jira] [JBoss JIRA] (JGRP-1864) UDP unable to bind to ephemeral port: port out of range:65536

Ion Savin (JIRA) issues at jboss.org
Thu Jul 31 08:54:29 EDT 2014


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

Ion Savin commented on JGRP-1864:
---------------------------------

Running this on the CI machine triggers the same exception:

{code}
package datagram_test;

import java.net.DatagramSocket;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.util.Enumeration;

public class Main {

   public static void main(String[] args) throws Exception {
      InetAddress inet6Addresses = getInet6Addresses();
      System.out.println(inet6Addresses);
      DatagramSocket datagramSocket = new DatagramSocket(4242, inet6Addresses);
      datagramSocket.close();
   }

   private static InetAddress getInet6Addresses() throws Exception {
      for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) {
         NetworkInterface intf = en.nextElement();
         for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) {
            InetAddress addr = enumIpAddr.nextElement();
            if (addr instanceof Inet6Address) {
               return addr;
            }
         }
      }
      return null;
   }
}
{code}

{noformat}
/fe80:0:0:0:f816:3eff:fe3b:55a9%2
Exception in thread "main" java.net.BindException: Cannot assign requested address
        at java.net.PlainDatagramSocketImpl.bind0(Native Method)
        at java.net.AbstractPlainDatagramSocketImpl.bind(AbstractPlainDatagramSocketImpl.java:95)
        at java.net.DatagramSocket.bind(DatagramSocket.java:376)
        at java.net.DatagramSocket.<init>(DatagramSocket.java:231)
        at java.net.DatagramSocket.<init>(DatagramSocket.java:284)
        at Main.main(Main.java:12)
{noformat}

> UDP unable to bind to ephemeral port: port out of range:65536
> -------------------------------------------------------------
>
>                 Key: JGRP-1864
>                 URL: https://issues.jboss.org/browse/JGRP-1864
>             Project: JGroups
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>    Affects Versions: 3.4.4
>            Reporter: Dan Berindei
>            Assignee: Bela Ban
>            Priority: Minor
>             Fix For: 3.4.5, 3.5
>
>
> It looks like {{UDP.createEphemeralDatagramSocket()}} swallows any errors it gets while creating the socket, and throws this exception after trying to bind to all ports in the 0 - 65535 range:
> {noformat}
> java.lang.IllegalArgumentException: port out of range:65536
>     at java.net.InetSocketAddress.checkPort(InetSocketAddress.java:143)
>     at java.net.InetSocketAddress.<init>(InetSocketAddress.java:185)
>     at java.net.DatagramSocket.<init>(DatagramSocket.java:284)
>     at org.jgroups.util.DefaultSocketFactory.createDatagramSocket(DefaultSocketFactory.java:62)
>     at org.jgroups.protocols.UDP.createEphemeralDatagramSocket(UDP.java:429)
>     at org.jgroups.protocols.UDP.createSockets(UDP.java:311)
>     at org.jgroups.protocols.UDP.start(UDP.java:216)
>     at org.jgroups.stack.ProtocolStack.startStack(ProtocolStack.java:966)
>     at org.jgroups.JChannel.startStack(JChannel.java:889)
>     at org.jgroups.JChannel._preConnect(JChannel.java:547)
>     at org.jgroups.JChannel.connect(JChannel.java:282)
>     at org.jgroups.JChannel.connect(JChannel.java:273)
>     at org.infinispan.remoting.transport.jgroups.JGroupsTransport.startJGroupsChannelIfNeeded(JGroupsTransport.java:200)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.2.6#6264)


More information about the jboss-jira mailing list