You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "Rakesh R (JIRA)" <ji...@apache.org> on 2016/10/16 15:08:20 UTC

[jira] [Commented] (ZOOKEEPER-2442) Socket leak in QuorumCnxManager connectOne

    [ https://issues.apache.org/jira/browse/ZOOKEEPER-2442?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15580106#comment-15580106 ] 

Rakesh R commented on ZOOKEEPER-2442:
-------------------------------------

I think this has to be back ported to {{branch-3.5}}, shall I merge this to branch-3.5, any comments?

> Socket leak in QuorumCnxManager connectOne
> ------------------------------------------
>
>                 Key: ZOOKEEPER-2442
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2442
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: quorum, server
>    Affects Versions: 3.5.1
>            Reporter: Michael Han
>            Assignee: Michael Han
>         Attachments: ZOOKEEPER-2442.patch
>
>
> The function connectOne() in QuorumCnxManager.java sometimes fails to release a socket allocated by Socket():
> {code}
>  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);
>             }
> {code}
> Another place in Listener.run() where the client socket is not explicitly closed.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)