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

ClientCnxn is not properly releasing the resources, which are used to ping RwServer

    Details

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

      Description

      While pinging to the RwServer, ClientCnxn is opening a socket and using BufferedReader. These are not properly closed in finally block and could cause leaks on exceptional cases.

      ClientCnxn#pingRwServer()

                  try {
                      Socket sock = new Socket(addr.getHostName(), addr.getPort());
                      BufferedReader br = new BufferedReader(
                              new InputStreamReader(sock.getInputStream()));
                      ......
                      sock.close();
                      br.close();
                  } catch (ConnectException e) {
                      // ignore, this just means server is not up
                  } catch (IOException e) {
                      // some unexpected error, warn about it
                      LOG.warn("Exception while seeking for r/w server " +
                              e.getMessage(), e);
                  }
      

        Attachments

          Activity

            People

            • Assignee:
              rakeshr Rakesh R
              Reporter:
              rakeshr Rakesh R
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: