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

Rakesh R commented on ZOOKEEPER-2105:
-------------------------------------

Thanks [~yuzhih...@gmail.com] for reporting this.

I could see, all the commands have the cleanup logic inside {{#run()}} method. 
After the execution of the {{#commandRun()}}, will do the cleanup in the 
{{finally block}}. Is that sufficient to close the printwriter ?

{{CommandThread.java}}
{code}
        public void run() {
            try {
                commandRun();
            } catch (IOException ie) {
                LOG.error("Error in running command ", ie);
            } finally {
                cleanupWriterSocket(pw);
            }
{code}

-Rakesh

> PrintWriter left unclosed in NIOServerCnxn#checkFourLetterWord
> --------------------------------------------------------------
>
>                 Key: ZOOKEEPER-2105
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2105
>             Project: ZooKeeper
>          Issue Type: Bug
>            Reporter: Ted Yu
>            Priority: Minor
>         Attachments: zookeeper-2105-v1.patch
>
>
> {code}
>         final PrintWriter pwriter = new PrintWriter(
>                 new BufferedWriter(new SendBufferWriter()));
> {code}
> pwriter should be closed upon return from the method.



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

Reply via email to