ZooKeeper
  1. ZooKeeper
  2. ZOOKEEPER-1309

Creating a new ZooKeeper client can leak file handles

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical 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.

      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

        Daniel Lord created issue -
        Daniel Lord made changes -
        Field Original Value New Value
        Status Open [ 1 ] Patch Available [ 10002 ]
        Daniel Lord made changes -
        Attachment zk-1309-1.patch [ 12505555 ]
        Patrick Hunt made changes -
        Status Patch Available [ 10002 ] Open [ 1 ]
        Daniel Lord made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Daniel Lord made changes -
        Status Patch Available [ 10002 ] Open [ 1 ]
        Daniel Lord made changes -
        Attachment zk-1309-1.patch [ 12506345 ]
        Patrick Hunt made changes -
        Assignee Daniel Lord [ dlord ]
        Patrick Hunt made changes -
        Fix Version/s 3.5.0 [ 12316644 ]
        Fix Version/s 3.4.1 [ 12318650 ]
        Fix Version/s 3.3.5 [ 12319081 ]
        Patrick Hunt made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Mahadev konar made changes -
        Status Patch Available [ 10002 ] Open [ 1 ]
        Fix Version/s 3.4.2 [ 12319196 ]
        Fix Version/s 3.4.1 [ 12318650 ]
        Daniel Lord made changes -
        Attachment zk-1309-1.patch [ 12506672 ]
        Mahadev konar made changes -
        Fix Version/s 3.4.3 [ 12319288 ]
        Fix Version/s 3.3.5 [ 12319081 ]
        Fix Version/s 3.4.2 [ 12319196 ]
        Daniel Lord made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Daniel Lord made changes -
        Status Patch Available [ 10002 ] Open [ 1 ]
        Daniel Lord made changes -
        Attachment zk-1309-3.patch [ 12511557 ]
        Daniel Lord made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Daniel Lord made changes -
        Status Patch Available [ 10002 ] Open [ 1 ]
        Patrick Hunt made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Fix Version/s 3.3.5 [ 12319081 ]
        Fix Version/s 3.5.0 [ 12316644 ]
        Fix Version/s 3.4.3 [ 12319288 ]
        Camille Fournier made changes -
        Status Patch Available [ 10002 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development