Uploaded image for project: 'ZooKeeper'
  1. ZooKeeper
  2. ZOOKEEPER-1683

ZooKeeper client NPE when updating server list on disconnected client

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.5.0
    • Fix Version/s: 3.5.0
    • Component/s: java client
    • Labels:
      None

      Description

      2013-04-04 22:16:15,872 ERROR [pool-4-thread-1] com.netflix.curator.ConnectionState.getZooKeeper (ConnectionState.java:84) - Background exception caught
      java.lang.NullPointerException
      at org.apache.zookeeper.client.StaticHostProvider.updateServerList(StaticHostProvider.java:161) ~[zookeeper-3.5.0.jar:3.5.0--1]
      at org.apache.zookeeper.ZooKeeper.updateServerList(ZooKeeper.java:183) ~[zookeeper-3.5.0.jar:3.5.0--1]
      at com.netflix.curator.HandleHolder$1$1.setConnectionString(HandleHolder.java:121) ~[curator-client-1.3.5-SNAPSHOT.jar:?]

      The duff code is this:

      ClientCnxnSocket clientCnxnSocket = cnxn.sendThread.getClientCnxnSocket();
      InetSocketAddress currentHost = (InetSocketAddress) clientCnxnSocket.getRemoteSocketAddress();
      boolean reconfigMode = hostProvider.updateServerList(serverAddresses, currentHost);

      Now, currentHost might be null, if we're not yet connected. But StaticHostProvider.updateServerList indirects on it unconditionally.

      This would be caught by findbugs.

        Attachments

        1. ZOOKEEPER-1683.patch
          13 kB
          Alexander Shraer
        2. ZOOKEEPER-1683-ver1.patch
          13 kB
          Alexander Shraer
        3. ZOOKEEPER-1683-ver2.patch
          14 kB
          Alexander Shraer
        4. ZOOKEEPER-1683-ver2.patch
          14 kB
          Alexander Shraer
        5. ZOOKEEPER-1683-ver5.patch
          14 kB
          Alexander Shraer
        6. ZOOKEEPER-1683-ver5.patch
          14 kB
          Alexander Shraer
        7. ZOOKEEPER-1683-ver6.patch
          15 kB
          Alexander Shraer
        8. ZOOKEEPER-1683-ver7.patch
          19 kB
          Alexander Shraer

          Issue Links

            Activity

              People

              • Assignee:
                shralex Alexander Shraer
                Reporter:
                arren Shevek
              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: