ZooKeeper
  1. ZooKeeper
  2. ZOOKEEPER-1460

IPv6 literal address not supported for quorum members

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 3.4.3
    • Fix Version/s: None
    • Component/s: quorum
    • Labels:
      None

      Description

      Via code inspection, I see that the "server.nnn" configuration key does not support literal IPv6 addresses because the property value is split on ":". In v3.4.3, the problem is in QuorumPeerConfig:

      String parts[] = value.split(":");
      InetSocketAddress addr = new InetSocketAddress(parts[0],
                              Integer.parseInt(parts[1]));
      

      In the current trunk (http://svn.apache.org/viewvc/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java?view=markup) this code has been refactored into QuorumPeer.QuorumServer, but the bug remains:

      String serverClientParts[] = addressStr.split(";");
      String serverParts[] = serverClientParts[0].split(":");
      addr = new InetSocketAddress(serverParts[0],
                              Integer.parseInt(serverParts[1]));
      

      This bug probably affects very few users because most will naturally use a hostname rather than a literal IP address. But given that IPv6 addresses are supported for clients via ZOOKEEPER-667 it seems that server support should be fixed too.

        Activity

        Joseph Walton made changes -
        Hide
        Joseph Walton added a comment -

        I've attached a patch to accept that syntax. Before splitting by : it attempts to extract a square-bracket-delimited component at the start of the string, and then splits the remainder as before.

        Tests for parsing are included.

        Show
        Joseph Walton added a comment - I've attached a patch to accept that syntax. Before splitting by : it attempts to extract a square-bracket-delimited component at the start of the string, and then splits the remainder as before. Tests for parsing are included.
        Hide
        Dr. Martin Menzel added a comment -

        We should use a typical IPv6 address/port configuration like

        server.1=[1234::f4b5:3fff:fe0f:e96e]:2888:3888

        in the case of literal IPv6 addresses. I think this would be more handy than splitting the configuration in several different properties (host/port) like in the client case.

        From my point of view this issue is not a IPv6 show stopper, because especially in the IPv6 case there are hostnames defined in DNS of /etc/hosts. If we use the hostnames the configuration is no problem.

        Show
        Dr. Martin Menzel added a comment - We should use a typical IPv6 address/port configuration like server.1= [1234::f4b5:3fff:fe0f:e96e] :2888:3888 in the case of literal IPv6 addresses. I think this would be more handy than splitting the configuration in several different properties (host/port) like in the client case. From my point of view this issue is not a IPv6 show stopper, because especially in the IPv6 case there are hostnames defined in DNS of /etc/hosts. If we use the hostnames the configuration is no problem.
        Thawan Kooburat made changes -
        Field Original Value New Value
        Assignee Thawan Kooburat [ thawan ]
        Hide
        Liping added a comment -

        Hi

        Is anyone looking into this issue?
        In our env, we do not want to depend on dns. So it is better if we have an official fix for it. Thanks.

        Liping

        Show
        Liping added a comment - Hi Is anyone looking into this issue? In our env, we do not want to depend on dns. So it is better if we have an official fix for it. Thanks. Liping
        Chris Dolan created issue -

          People

          • Assignee:
            Thawan Kooburat
            Reporter:
            Chris Dolan
          • Votes:
            4 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

            • Created:
              Updated:

              Development