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

Socket leak in QuorumCnxManager connectOne

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.5.1
    • 3.5.3, 3.6.0
    • quorum, server
    • None

    Description

      The function connectOne() in QuorumCnxManager.java sometimes fails to release a socket allocated by Socket():

       try {
      
                      if (LOG.isDebugEnabled()) {
                          LOG.debug("Opening channel to server " + sid);
                      }
                      Socket sock = new Socket();
                      setSockOpts(sock);
                      sock.connect(self.getView().get(sid).electionAddr, cnxTO);
                      if (LOG.isDebugEnabled()) {
                          LOG.debug("Connected to server " + sid);
                      }
                      initiateConnection(sock, sid);
                  } catch (UnresolvedAddressException e) {
                      // Sun doesn't include the address that causes this
                      // exception to be thrown, also UAE cannot be wrapped cleanly
                      // so we log the exception in order to capture this critical
                      // detail.
                      LOG.warn("Cannot open channel to " + sid
                              + " at election address " + electionAddr, e);
                      throw e;
                  } catch (IOException e) {
                      LOG.warn("Cannot open channel to " + sid
                              + " at election address " + electionAddr,
                              e);
                  }
      

      Another place in Listener.run() where the client socket is not explicitly closed.

      Attachments

        1. ZOOKEEPER-2442.patch
          5 kB
          Michael Han

        Activity

          People

            hanm Michael Han
            hanm Michael Han
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: