You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "chungen0126 (via GitHub)" <gi...@apache.org> on 2025/06/17 06:12:01 UTC

[PR] HDDS-12843. Intermittent NPE in TestDecommissionAndMaintenance [ozone]

chungen0126 opened a new pull request, #8643:
URL: https://github.com/apache/ozone/pull/8643

   ## What changes were proposed in this pull request?
   
    Two intermittent failures in TestDecommissionAndMaintenance
   ```
   	at org.apache.ozone.test.GenericTestUtils.waitFor(GenericTestUtils.java:116)
   	at org.apache.hadoop.ozone.MiniOzoneClusterImpl.waitForClusterToBeReady(MiniOzoneClusterImpl.java:166)
   	at org.apache.hadoop.ozone.MiniOzoneClusterImpl.restartStorageContainerManager(MiniOzoneClusterImpl.java:291)
   	at org.apache.hadoop.hdds.scm.node.TestDecommissionAndMaintenance.testDecommissioningNodesCompleteDecommissionOnSCMRestart(TestDecommissionAndMaintenance.java:279)
   	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
   	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
   	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
   ```
   ```
   org.apache.hadoop.hdds.scm.node.TestDecommissionAndMaintenance.testSingleNodeWithOpenPipelineCanGotoMaintenance -- Time elapsed: 18.06 s <<< ERROR!
   java.lang.NullPointerException: Cannot invoke "org.apache.hadoop.ozone.container.common.helpers.DatanodeIdYaml$DatanodeDetailsYaml.getUuid()" because "datanodeDetailsYaml" is null
   	at org.apache.hadoop.ozone.container.common.helpers.DatanodeIdYaml.readDatanodeIdFile(DatanodeIdYaml.java:91)
   	at org.apache.hadoop.ozone.container.common.helpers.ContainerUtils.readDatanodeDetailsFrom(ContainerUtils.java:177)
   	at org.apache.hadoop.ozone.HddsDatanodeService.initializeDatanodeDetails(HddsDatanodeService.java:428)
   	at org.apache.hadoop.ozone.HddsDatanodeService.start(HddsDatanodeService.java:223)
   	at org.apache.hadoop.ozone.MiniOzoneClusterImpl.startHddsDatanode(MiniOzoneClusterImpl.java:424)
   	at org.apache.hadoop.ozone.MiniOzoneClusterImpl.restartHddsDatanode(MiniOzoneClusterImpl.java:362)
   	at org.apache.hadoop.ozone.MiniOzoneClusterImpl.restartHddsDatanode(MiniOzoneClusterImpl.java:372)
   	at org.apache.hadoop.hdds.scm.node.TestDecommissionAndMaintenance.testSingleNodeWithOpenPipelineCanGotoMaintenance(TestDecommissionAndMaintenance.java:462)
   	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
   	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
   	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596) 
   ```
   
   
   The root causes of the failures:
   1. The first failure occurs after [c7117dc](https://github.com/apache/ozone/commit/c7117dcc1731a5f8a82fc6f06b99bda9cd6e01c0), due to an accidental addition of `ecContainerDNsMap.clear()`.
   2. The second failure is that we currently update DatanodeDetails in memory before persisting it to disk. If the persist step fails, the in-memory state is already changed and SCM may receive this incorrect state via heartbeat.
   SCM might think a datanode is already in IN_MAINTENANCE because of the heartbeat, but the actual state wasn’t persisted. If the user then shutdown the datanode, thinking it's safe, the datanode may fail to restart because it's missing persisted datanode details.
   
   What does this pr change?
   
   1. Remove  `ecContainerDNsMap.clear()` in `ECContainerSafeModeRule#initializeRule`.
   2. This improves state consistency in the datanode.
   
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-12843
   
   ## How was this patch tested?
   CI:
   https://github.com/chungen0126/ozone/actions/runs/15698436934
   
   Passed 20x50 after change:
   https://github.com/chungen0126/ozone/actions/runs/15697148311
   


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-12843. Intermittent NPE in TestDecommissionAndMaintenance [ozone]

Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on PR #8643:
URL: https://github.com/apache/ozone/pull/8643#issuecomment-3064894374

   Thanks @chungen0126 for the patch, @jojochuang, @peterxcli for the review.
   
   We can inline `persistUpdatedDatanodeDetails` in a follow-up, if you prefer.


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-12843. Intermittent NPE in TestDecommissionAndMaintenance [ozone]

Posted by "peterxcli (via GitHub)" <gi...@apache.org>.
peterxcli commented on code in PR #8643:
URL: https://github.com/apache/ozone/pull/8643#discussion_r2163201535


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/SetNodeOperationalStateCommandHandler.java:
##########
@@ -92,11 +92,8 @@ public void handle(SCMCommand<?> command, OzoneContainer container,
     DatanodeDetails dni = context.getParent().getDatanodeDetails();
     HddsProtos.NodeOperationalState state =
         setNodeCmdProto.getNodeOperationalState();
-    dni.setPersistedOpState(state);
-    dni.setPersistedOpStateExpiryEpochSec(
-        setNodeCmd.getStateExpiryEpochSeconds());
     try {
-      persistDatanodeDetails(dni);
+      persistUpdatedDatanodeDetails(dni, state, setNodeCmd.getStateExpiryEpochSeconds());

Review Comment:
   yes. what do you think?



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-12843. Intermittent NPE in TestDecommissionAndMaintenance [ozone]

Posted by "chungen0126 (via GitHub)" <gi...@apache.org>.
chungen0126 commented on code in PR #8643:
URL: https://github.com/apache/ozone/pull/8643#discussion_r2152725510


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/safemode/ECContainerSafeModeRule.java:
##########
@@ -194,7 +194,6 @@ private void recordReportedContainer(long containerID) {
 
   private void initializeRule() {
     ecContainers.clear();
-    ecContainerDNsMap.clear();

Review Comment:
   The aim is not to try to solve the issue but to avoid intermittent failures for now. The main thing being done here is restoring the accidental addition in [c7117dc](https://github.com/apache/ozone/commit/c7117dcc1731a5f8a82fc6f06b99bda9cd6e01c0).



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-12843. Intermittent NPE in TestDecommissionAndMaintenance [ozone]

Posted by "chungen0126 (via GitHub)" <gi...@apache.org>.
chungen0126 commented on code in PR #8643:
URL: https://github.com/apache/ozone/pull/8643#discussion_r2152725510


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/safemode/ECContainerSafeModeRule.java:
##########
@@ -194,7 +194,6 @@ private void recordReportedContainer(long containerID) {
 
   private void initializeRule() {
     ecContainers.clear();
-    ecContainerDNsMap.clear();

Review Comment:
   I also don't think that the issue has been tested in the current code base. The aim is not to try to solve the issue but to avoid intermittent failures for now. The main thing being done here is restoring the accidental addition in [c7117dc](https://github.com/apache/ozone/commit/c7117dcc1731a5f8a82fc6f06b99bda9cd6e01c0).



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-12843. Intermittent NPE in TestDecommissionAndMaintenance [ozone]

Posted by "peterxcli (via GitHub)" <gi...@apache.org>.
peterxcli commented on code in PR #8643:
URL: https://github.com/apache/ozone/pull/8643#discussion_r2152286008


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/safemode/ECContainerSafeModeRule.java:
##########
@@ -194,7 +194,6 @@ private void recordReportedContainer(long containerID) {
 
   private void initializeRule() {
     ecContainers.clear();
-    ecContainerDNsMap.clear();

Review Comment:
   Thanks for catching this, I think this is what https://issues.apache.org/jira/browse/HDDS-11693 is trying to solve.



##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/SetNodeOperationalStateCommandHandler.java:
##########
@@ -92,11 +92,8 @@ public void handle(SCMCommand<?> command, OzoneContainer container,
     DatanodeDetails dni = context.getParent().getDatanodeDetails();
     HddsProtos.NodeOperationalState state =
         setNodeCmdProto.getNodeOperationalState();
-    dni.setPersistedOpState(state);
-    dni.setPersistedOpStateExpiryEpochSec(
-        setNodeCmd.getStateExpiryEpochSeconds());
     try {
-      persistDatanodeDetails(dni);
+      persistUpdatedDatanodeDetails(dni, state, setNodeCmd.getStateExpiryEpochSeconds());

Review Comment:
   I think this behaviour should be more explicit.
   ```suggestion
         DatanodeDetails persistedDni = new DatanodeDetails(dni)
           .setPersistedOpState(state)
           .setPersistedOpStateExpiryEpochSec(stateExpiryEpochSeconds);
         persistDatanodeDetails(persistedDni);
         // Only update the inmem state if datanodeDetails is persisted successfully
         dni.setPersistedOpState(state);
         dni.setPersistedOpStateExpiryEpochSec(stateExpiryEpochSeconds);
   ```



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-12843. Intermittent NPE in TestDecommissionAndMaintenance [ozone]

Posted by "chungen0126 (via GitHub)" <gi...@apache.org>.
chungen0126 commented on code in PR #8643:
URL: https://github.com/apache/ozone/pull/8643#discussion_r2152736712


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/SetNodeOperationalStateCommandHandler.java:
##########
@@ -92,11 +92,8 @@ public void handle(SCMCommand<?> command, OzoneContainer container,
     DatanodeDetails dni = context.getParent().getDatanodeDetails();
     HddsProtos.NodeOperationalState state =
         setNodeCmdProto.getNodeOperationalState();
-    dni.setPersistedOpState(state);
-    dni.setPersistedOpStateExpiryEpochSec(
-        setNodeCmd.getStateExpiryEpochSeconds());
     try {
-      persistDatanodeDetails(dni);
+      persistUpdatedDatanodeDetails(dni, state, setNodeCmd.getStateExpiryEpochSeconds());

Review Comment:
   This doesn't make sense. `persistedDni ` is not a builder.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-12843. Intermittent NPE in TestDecommissionAndMaintenance [ozone]

Posted by "chungen0126 (via GitHub)" <gi...@apache.org>.
chungen0126 commented on code in PR #8643:
URL: https://github.com/apache/ozone/pull/8643#discussion_r2152725510


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/safemode/ECContainerSafeModeRule.java:
##########
@@ -194,7 +194,6 @@ private void recordReportedContainer(long containerID) {
 
   private void initializeRule() {
     ecContainers.clear();
-    ecContainerDNsMap.clear();

Review Comment:
   I don't think that the issue has been tested in this class. The aim is not to try to solve the issue but to avoid intermittent failures for now. The main thing being done here is restoring the accidental addition in [c7117dc](https://github.com/apache/ozone/commit/c7117dcc1731a5f8a82fc6f06b99bda9cd6e01c0).



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-12843. Intermittent NPE in TestDecommissionAndMaintenance [ozone]

Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai merged PR #8643:
URL: https://github.com/apache/ozone/pull/8643


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-12843. Intermittent NPE in TestDecommissionAndMaintenance [ozone]

Posted by "peterxcli (via GitHub)" <gi...@apache.org>.
peterxcli commented on code in PR #8643:
URL: https://github.com/apache/ozone/pull/8643#discussion_r2152286008


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/safemode/ECContainerSafeModeRule.java:
##########
@@ -194,7 +194,6 @@ private void recordReportedContainer(long containerID) {
 
   private void initializeRule() {
     ecContainers.clear();
-    ecContainerDNsMap.clear();

Review Comment:
   Thanks for catching this, I believe this is what https://issues.apache.org/jira/browse/HDDS-11693 is trying to solve.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-12843. Intermittent NPE in TestDecommissionAndMaintenance [ozone]

Posted by "chungen0126 (via GitHub)" <gi...@apache.org>.
chungen0126 commented on code in PR #8643:
URL: https://github.com/apache/ozone/pull/8643#discussion_r2152725510


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/safemode/ECContainerSafeModeRule.java:
##########
@@ -194,7 +194,6 @@ private void recordReportedContainer(long containerID) {
 
   private void initializeRule() {
     ecContainers.clear();
-    ecContainerDNsMap.clear();

Review Comment:
   I don't think that the issue has been tested in the current code base. The aim is not to try to solve the issue but to avoid intermittent failures for now. The main thing being done here is restoring the accidental addition in [c7117dc](https://github.com/apache/ozone/commit/c7117dcc1731a5f8a82fc6f06b99bda9cd6e01c0).



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-12843. Intermittent NPE in TestDecommissionAndMaintenance [ozone]

Posted by "chungen0126 (via GitHub)" <gi...@apache.org>.
chungen0126 commented on code in PR #8643:
URL: https://github.com/apache/ozone/pull/8643#discussion_r2152736712


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/SetNodeOperationalStateCommandHandler.java:
##########
@@ -92,11 +92,8 @@ public void handle(SCMCommand<?> command, OzoneContainer container,
     DatanodeDetails dni = context.getParent().getDatanodeDetails();
     HddsProtos.NodeOperationalState state =
         setNodeCmdProto.getNodeOperationalState();
-    dni.setPersistedOpState(state);
-    dni.setPersistedOpStateExpiryEpochSec(
-        setNodeCmd.getStateExpiryEpochSeconds());
     try {
-      persistDatanodeDetails(dni);
+      persistUpdatedDatanodeDetails(dni, state, setNodeCmd.getStateExpiryEpochSeconds());

Review Comment:
   Do you mean we don't need `persistUpdatedDatanodeDetails`?



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org