Repository navigation
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Shutdown cancellation can race with health-check rescheduling, allowing delayed tasks to keep close() blocked.
1 open finding
What changed in this PR
This PR reduces SCM shutdown latency by cancelling the pending NodeStateManager health check and adding regression coverage.
Changes:
- Cancel the scheduled health-check task during shutdown.
- Add a test ensuring
close()returns promptly.
| File | Description |
|---|---|
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestNodeStateManager.java |
Verifies close() does not wait for the delayed health check. |
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/NodeStateManager.java |
Cancels the pending health-check task during shutdown. |
🧠 Review effort: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…olicy Cancelling the future in close() could race with a running health check that reschedules itself before shutdown(). Let shutdown() discard delayed tasks instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Generated-by: Claude Code (Opus 5.5)
What changes were proposed in this pull request?
NodeStateManagerschedules its health check as a one-shot taskozone.scm.heartbeat.thread.interval(3s by default) in the future, and reschedules it after each run.close()callsexecutorService.shutdown(), which still lets already scheduled delayed tasks run, and thenawaitTermination. As a resultclose()blocks until the pending health check fires, up to 3s. This delays every SCM stop, and every test that closes a realSCMNodeManagerpays the wait once per test.This PR sets
setExecuteExistingDelayedTasksAfterShutdownPolicy(false)on the executor, soshutdown()discards the pending health check andclose()no longer waits for it.Test class time in CI, four recent master runs compared to a run of this fix on my fork:
TestDeletedBlockLogTestSCMNodeManagerTestSCMBlockProtocolServerTestIncrementalContainerReportHandlerTestReconNodeManagerTestDeadNodeHandlerWhat is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-16926
How was this patch tested?
TestNodeStateManager#testCloseDoesNotWaitForPendingHealthCheck. It fails without the fix (close()takes 3s).🤖 Generated with Claude Code