Copilot commented on code in PR #11480:
URL: https://github.com/apache/ozone/pull/11480#discussion_r4244710917


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/NodeStateManager.java:
##########
@@ -885,6 +885,10 @@ private void fireHealthStateEvent(HddsProtos.NodeState 
health,
 
   @Override
   public void close() {
+    // Cancel the pending delayed health check, otherwise awaitTermination 
waits for it to fire.
+    if (healthCheckFuture != null) {
+      healthCheckFuture.cancel(false);

Review Comment:
   `cancel(false)` does not stop a health check that has already started. If 
`run()` reaches `scheduleNextHealthCheck()` between this cancellation and 
`shutdown()`, it can enqueue a new delayed future; the executor's default 
shutdown policy still executes delayed tasks already queued, so 
`awaitTermination()` can again block for the full heartbeat interval. Please 
make cancellation/shutdown atomic with rescheduling (or otherwise disable 
execution of delayed tasks on shutdown) so close is bounded even when shutdown 
races with a health check.



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