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

Owen O'Malley commented on HIVE-4500:
-------------------------------------

{quote}
Which part of the patch are you referring to ? Is it the change in 
HiveSessionImpl.java ?
{quote}

I'm sorry, I was assuming that since you were calling IOUtils.cleanup, which 
throws away exceptions, that it was in a finally block outside of the patch.

{quote}
This is not true as long as the finally block does not throw an exception of 
it's own. Thus finally blocks should not throw an Exception.
{quote}

If the finally block calls a method like IOUtils.cleanup that discards 
exceptions it will miss exceptions on the close. For example, if the code looks 
like:

{code}
OutputStream stream = null;
try {
  ...
} finally {
  IOUtils.cleanup(stream);
}
{code}

Then in the case where the close, which likely includes the last write to the 
stream, fails that exception will be lost. The right code is:

{code}
OutputStream stream = null;
try {
  ...
  stream.close();
} catch (Throwable th) {
  IOUtils.cleanup(stream);
  throw new IOException("something", th);
}
{code}

                
> HS2 holding too many file handles of hive_job_log_hive_*.txt files
> ------------------------------------------------------------------
>
>                 Key: HIVE-4500
>                 URL: https://issues.apache.org/jira/browse/HIVE-4500
>             Project: Hive
>          Issue Type: Bug
>          Components: HiveServer2
>    Affects Versions: 0.11.0
>            Reporter: Alan Gates
>            Assignee: Alan Gates
>         Attachments: HIVE-4500-2.patch, HIVE-4500-3.patch, HIVE-4500.patch
>
>
> In the hiveserver2 setup used for testing, we see that it has 2444 files open 
> and of them 2152 are /tmp/hive/hive_job_log_hive_*.txt files

--
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