smengcl commented on code in PR #11264:
URL: https://github.com/apache/ozone/pull/11264#discussion_r4056155158


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/DatanodeStateMachine.java:
##########
@@ -400,6 +400,18 @@ private void startStateMachineThread() throws IOException {
     }
   }
 
+  /**
+   * Terminates the datanode when startup cannot make progress and the state
+   * machine loop cannot drive the shutdown itself (for example when container
+   * initialization has stalled on a thread that ignores interruption). Invoked
+   * from the {@link 
org.apache.hadoop.ozone.container.ozoneimpl.OzoneContainer}
+   * startup watchdog.
+   */
+  public void triggerFatalShutdown(String reason) {
+    LOG.error("DatanodeStateMachine shutdown triggered: {}", reason);
+    hddsDatanodeStopService.stopService();

Review Comment:
   The watchdog can still hang before reaching JVM exit. `stopService()` calls 
`HddsDatanodeService.terminateDatanode()`, which runs synchronous `stop()` 
before `terminate(1)`.
   
   Container scanners start before Ratis recovery. If a scanner also blocks on 
the failing disk, `stopContainerScrub()` waits indefinitely in 
`AbstractBackgroundContainerScanner.shutdown()` -> `Thread.join()`.
   
   Could we enter JVM shutdown directly here? The standalone datanode already 
registers `stop()`/`join()` through Ozone's `ShutdownHookManager`, which bounds 
hook execution.



-- 
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.

To unsubscribe, e-mail: [email protected]

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