Rakesh R created ZOOKEEPER-1753:
-----------------------------------

             Summary: ClientCnxn is not properly releasing the resources, which 
are used to ping RwServer
                 Key: ZOOKEEPER-1753
                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1753
             Project: ZooKeeper
          Issue Type: Bug
          Components: java client
            Reporter: Rakesh R
            Assignee: Rakesh R


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()
{code}
            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);
            }
{code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to