Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-12748

Uncaught exceptions are not caught/logged when ExecutorService is used

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      When tasks running in a ThreadPoolExecutor throw an error/exception that is otherwise uncaught, it might not be propagated to the thread's uncaught exception handler because enclosing tasks (e.g FutureTask) might capture these exceptions (and do nothing). For more details, see : https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ThreadPoolExecutor.html#afterExecute-java.lang.Runnable-java.lang.Throwable-

      To ensure such errors are logged, 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

      Some test code that demonstrates this issue is attached.

        Attachments

        1. TestUncaughExceptionHandler.java
          4 kB
          Sidharta Seethana

          Activity

            People

            • Assignee:
              sidharta-s Sidharta Seethana
              Reporter:
              sidharta-s Sidharta Seethana
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: