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 2013/09/05 16:37:52 UTC

[jira] [Created] (ZOOKEEPER-1753) ClientCnxn is not properly releasing the resources, which are used to ping RwServer

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