hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Loughran (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HADOOP-14526) Examine code base for cases that exception is thrown from finally block
Date Thu, 10 Aug 2017 19:53:00 GMT

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

Steve Loughran commented on HADOOP-14526:
-----------------------------------------

This is a fun one. Not easy to find & fix, as in "not easy to even decide what is a good
solution here, given some codepaths may expect an exception to be raised from that finally
clause in the case of some failures*

# Spark plays games with closures to have a finally clause which catches & logs exceptions
raised in finally
# We could adopt try-with-resources for releasing resources more thoroughly, but I'm not sure
what happens when something throws an exception in close() there.



> Examine code base for cases that exception is thrown from finally block
> -----------------------------------------------------------------------
>
>                 Key: HADOOP-14526
>                 URL: https://issues.apache.org/jira/browse/HADOOP-14526
>             Project: Hadoop Common
>          Issue Type: Bug
>            Reporter: Yongjun Zhang
>
> If exception X is thrown in try block, and exception Y is thrown is finally block, X
will be swallowed. 
> In addition, finally block is used to ensure resources are released properly in general.
If we throw exception from there, some resources may be leaked. So it's not recommended to
throw exception in the finally block
> I caught one today and reported HDFS-11974, creating this jira as a master one to catch
other similar cases.
> Hope there is some static analyzer to find all.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org


Mime
View raw message