GlenGeng commented on a change in pull request #1533:
URL: https://github.com/apache/ozone/pull/1533#discussion_r520276142



##########
File path: 
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/DatanodeStateMachine.java
##########
@@ -399,18 +390,27 @@ public boolean isTransitionAllowedTo(DatanodeStates 
newState) {
    * Start datanode state machine as a single thread daemon.
    */
   public void startDaemon() {
-    Runnable startStateMachineTask = () -> {
-      try {
-        start();
-        LOG.info("Ozone container server started.");
-      } catch (Exception ex) {
-        LOG.error("Unable to start the DatanodeState Machine", ex);
-      }
-    };
+    reportManager.init();
+    initCommandHandlerThread(conf);
+
+    // Start jvm monitor
+    jvmPauseMonitor = new JvmPauseMonitor();
+    jvmPauseMonitor
+        .init(LegacyHadoopConfigurationSource.asHadoopConfiguration(conf));
+    jvmPauseMonitor.start();
+
     stateMachineThread =  new ThreadFactoryBuilder()
         .setDaemon(true)
         .setNameFormat("Datanode State Machine Thread - %d")
-        .build().newThread(startStateMachineTask);
+        .setUncaughtExceptionHandler((Thread t, Throwable e) -> {

Review comment:
       Yes, we know the uncaught exception, it is the OOM due to queued reports 
for a dead Recon. You may find the detail from above conversations.
   
   Either a HA solution or a fast fail solution is fine to me.
   BTW, the restart thread solution is already used in `cmdProcessThread` and 
`leaseMonitorThread`.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to