This is an automated email from the ASF dual-hosted git repository.

lhaiesp pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/samza.git


The following commit(s) were added to refs/heads/master by this push:
     new c527ec5  SAMZA-2491: AM should log uncaught exceptions and System.exit 
to ensure that the process dies on errors (#1325)
c527ec5 is described below

commit c527ec5a151e0da570dfdc3896c30694ac7c34f6
Author: Hai Lu <[email protected]>
AuthorDate: Fri Mar 27 22:36:05 2020 -0700

    SAMZA-2491: AM should log uncaught exceptions and System.exit to ensure 
that the process dies on errors (#1325)
    
    Symptom: A job deployment timed out waiting for application attempt to 
transition from New to Running.
    
    Cause: ClusterBasedJobCoordinator threw an exception during startup due to 
a misconfiguration, but did not kill the AM process (likely due to non-daemon 
threads).
---
 .../org/apache/samza/clustermanager/ClusterBasedJobCoordinator.java  | 5 +++++
 1 file changed, 5 insertions(+)

diff --git 
a/samza-core/src/main/java/org/apache/samza/clustermanager/ClusterBasedJobCoordinator.java
 
b/samza-core/src/main/java/org/apache/samza/clustermanager/ClusterBasedJobCoordinator.java
index e7647f4..e155b58 100644
--- 
a/samza-core/src/main/java/org/apache/samza/clustermanager/ClusterBasedJobCoordinator.java
+++ 
b/samza-core/src/main/java/org/apache/samza/clustermanager/ClusterBasedJobCoordinator.java
@@ -464,12 +464,17 @@ public class ClusterBasedJobCoordinator {
   public static void main(String[] args) {
     boolean dependencyIsolationEnabled = Boolean.parseBoolean(
         
System.getenv(ShellCommandConfig.ENV_CLUSTER_BASED_JOB_COORDINATOR_DEPENDENCY_ISOLATION_ENABLED));
+    Thread.setDefaultUncaughtExceptionHandler((thread, exception) -> {
+        LOG.error("Uncaught exception in ClusterBasedJobCoordinator::main. 
Exiting job coordinator", exception);
+        System.exit(1);
+      });
     if (!dependencyIsolationEnabled) {
       // no isolation enabled, so can just execute 
runClusterBasedJobCoordinator directly
       runClusterBasedJobCoordinator(args);
     } else {
       runWithClassLoader(new IsolatingClassLoaderFactory().buildClassLoader(), 
args);
     }
+    System.exit(0);
   }
 
   /**

Reply via email to