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

Creating a new ZooKeeper client can leak file handles

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 3.3.4
    • Fix Version/s: 3.3.5
    • Component/s: java client
    • Labels:
      None

      Description

      If there is an IOException thrown by the constructor of ClientCnxn then file handles are leaked because of the initialization of the Selector which is never closed.

      final Selector selector = Selector.open();

      If there is an abnormal exit from the constructor then the Selector is not closed and file handles are leaked. You can easily see this by setting the hosts string to garbage ("qwerty", "asdf", etc.) and then try to open a new ZooKeeper connection. I've observed the same behavior in production when there were DNS issues where the host names of the ensemble can no longer be resolved and the application servers quickly run out of handles attempting to (re)connect to zookeeper.

        Attachments

        1. zk-1309-3.patch
          2 kB
          Daniel Lord
        2. zk-1309-1.patch
          2 kB
          Daniel Lord
        3. zk-1309-1.patch
          2 kB
          Daniel Lord
        4. zk-1309-1.patch
          2 kB
          Daniel Lord

          Activity

            People

            • Assignee:
              dlord Daniel Lord
              Reporter:
              dlord Daniel Lord
            • Votes:
              3 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: