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

Brock Noland commented on HIVE-4500:
------------------------------------

bq. 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:

That's an incorrect idiom and shouldn't damn all finally use.

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

Granted that was an example but a Throwable should never be blindly converted 
to an IOException. Hadoop is too often guilty of this. I believe the following 
to be more correct as it doesn't convert all Throwables to IOException and only 
eats an exception on close if a previous exception as thrown, which is the same 
as your example.

{code}
OutputStream stream = null;
try {
  ...
  stream.close();
  stream = null;
} finally {
  IOUtils.cleanup(stream);
}
{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
>             Fix For: 0.11.0
>
>         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