Uploaded image for project: 'mod_cluster'
  1. mod_cluster
  2. MODCLUSTER-746

Creating an IPv4 multicast socket on Windows while java.net.preferIPv6Addresses=true can throw UnsupportedAddressTypeException

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 2.0.1.Final
    • 2.0.0.Final
    • Core + SPIs
    • None

    Description

      Under specific configuration where:

      1. an IPv4 multicast address is used
      2. while java.net.preferIPv6Addresses=true is set
      3. and while on Windows platform (i.e. or a platform that doesn't support binding to a multicast address)

      the following exception can happen (example from when used in WildFly):

      WFLYCTL0186:   Services which failed to start:      service org.wildfly.mod_cluster.service.default.undertow: java.nio.channels.UnsupportedAddressTypeException
      

      Seemingly while we are using the same code as in JDK, the JDK simply doens't do the check again; from JDK11 code

        private void bindInternal(SocketAddress local) throws IOException {
              assert Thread.holdsLock(stateLock) && (localAddress == null);
      
              InetSocketAddress isa;
              if (local == null) {
                  // only Inet4Address allowed with IPv4 socket
                  if (family == StandardProtocolFamily.INET) {
                      isa = new InetSocketAddress(InetAddress.getByName("0.0.0.0"), 0);
                  } else {
                      isa = new InetSocketAddress(0);
                  }
              } else {
                  isa = Net.checkAddress(local, family);
              }
              SecurityManager sm = System.getSecurityManager();
              if (sm != null)
                  sm.checkListen(isa.getPort());
      
              Net.bind(family, fd, isa.getAddress(), isa.getPort());
              localAddress = Net.localAddress(fd);
          }
      

      Attachments

        Activity

          People

            rhn-engineering-rhusar Radoslav Husar
            rhn-engineering-rhusar Radoslav Husar
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: