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

Sidharta Seethana updated HADOOP-12748:
---------------------------------------
    Description: 
{{ThreadPoolExecutor}} catches (otherwise uncaught) exceptions/errors thrown by 
the tasks running in the corresponding thread pool. These are passed to an 
{{afterExecute}} method which seems to do nothing by default unless overridden. 
 Even though we register {{UncaughtExceptionHandler}}s in various places (e.g 
{{YarnUncaughtExceptionHandler}}), these handlers are not invoked because the 
uncaught exceptions/errors are not propagated all the way. 

To fix this, one mechanism would be to override {{ThreadPoolExecutor}} with an 
{{afterExecute}} method that would log these exceptions/errors. Logging these 
exceptions/errors would be useful in debugging issues that are otherwise 
difficult to trace (e.g YARN-4643) because there is nothing in the logs 
indicating an uncaught exception/error 

Edit: uploaded some test code that demonstrates this issue. 


  was:
{{ThreadPoolExecutor}} catches (otherwise uncaught) exceptions/errors thrown by 
the tasks running in the corresponding thread pool. These are passed to an 
{{afterExecute}} method which seems to do nothing by default unless overridden. 
 Even though we register {{UncaughtExceptionHandler}}s in various places (e.g 
{{YarnUncaughtExceptionHandler}}), these handlers are not invoked because the 
uncaught exceptions/errors are not propagated all the way. 

To fix this, one mechanism would be to override {{ThreadPoolExecutor}} with an 
{{afterExecute}} method that would log these exceptions/errors. Logging these 
exceptions/errors would be useful in debug issues that are otherwise difficult 
to trace (e.g YARN-4643) because there is nothing in the logs indicating an 
uncaught exception/error 

Edit: uploaded some test code that demonstrates this issue. 



> Uncaught exceptions are not caught/logged when ExecutorService is used
> ----------------------------------------------------------------------
>
>                 Key: HADOOP-12748
>                 URL: https://issues.apache.org/jira/browse/HADOOP-12748
>             Project: Hadoop Common
>          Issue Type: Bug
>            Reporter: Sidharta Seethana
>            Assignee: Sidharta Seethana
>         Attachments: TestUncaughExceptionHandler.java
>
>
> {{ThreadPoolExecutor}} catches (otherwise uncaught) exceptions/errors thrown 
> by the tasks running in the corresponding thread pool. These are passed to an 
> {{afterExecute}} method which seems to do nothing by default unless 
> overridden.  Even though we register {{UncaughtExceptionHandler}}s in various 
> places (e.g {{YarnUncaughtExceptionHandler}}), these handlers are not invoked 
> because the uncaught exceptions/errors are not propagated all the way. 
> To fix this, one mechanism would be to override {{ThreadPoolExecutor}} with 
> an {{afterExecute}} method that would log these exceptions/errors. Logging 
> these exceptions/errors would be useful in debugging issues that are 
> otherwise difficult to trace (e.g YARN-4643) because there is nothing in the 
> logs indicating an uncaught exception/error 
> Edit: uploaded some test code that demonstrates this issue. 



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

Reply via email to