[ 
https://issues.apache.org/jira/browse/HDFS-8842?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Colin Patrick McCabe updated HDFS-8842:
---------------------------------------
    Target Version/s: 2.7.1, 2.5.2, 2.5.1, 2.7.0, 2.6.0  (was: 2.6.0, 2.7.0, 
2.5.1, 2.5.2, 2.7.1)
            Priority: Trivial  (was: Critical)

> Catch throwable 
> ----------------
>
>                 Key: HDFS-8842
>                 URL: https://issues.apache.org/jira/browse/HDFS-8842
>             Project: Hadoop HDFS
>          Issue Type: Bug
>            Reporter: songwanging
>            Priority: Trivial
>
> We came across a few instances where the code catches Throwable, but fails to 
> rethrow anything.
> Throwable is the parent type of Exception and Error, so catching Throwable 
> means catching both Exceptions as well as Errors. An Exception is something 
> you could recover (like IOException), an Error is something more serious and 
> usually you could'nt recover easily (like ClassNotFoundError) so it doesn't 
> make much sense to catch an Error. 
> We should convert Throwable to Exception.
> For example:
> In method tryGetPid(Process p) of class: 
> hadoop-2.7.1-src\hadoop-common-project\hadoop-common\src\main\java\org\apache\hadoop\ha\ShellCommandFencer.java
> code:
> private static String tryGetPid(Process p) {
>     try {
>     ...
>     } catch (Throwable t) {
>       LOG.trace("Unable to determine pid for " + p, t);
>       return null;
>     }
>   }
> In method uncaughtException(Thread t, Throwable e) of class: 
> hadoop-2.7.1-src\hadoop-yarn-project\hadoop-yarn\hadoop-yarn-common\src\main\java\org\apache\hadoop\yarn\YarnUncaughtExceptionHandler.java
> code:
> public void uncaughtException(Thread t, Throwable e) {
>    ...
>       try {
>         LOG.fatal("Thread " + t + " threw an Error.  Shutting down now...", 
> e);
>       } catch (Throwable err) {
>         //We don't want to not exit because of an issue with logging
>       }
>     ...
>         try {
>           System.err.println("Halting due to Out Of Memory Error...");
>         } catch (Throwable err) {
>           //Again we done want to exit because of logging issues.
>         }
>  ...
> }



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

Reply via email to