{"record":{"id":"6bf480925fd197bc","repo":"apache/hadoop","slug":"received-unimplemented-dna-shutdown","errorCode":null,"errorMessage":"Received unimplemented DNA_SHUTDOWN","messagePattern":"Received unimplemented DNA_SHUTDOWN","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPOfferService.java","lineNumber":773,"sourceCode":"        throw e;\n      }\n      break;\n    case DatanodeProtocol.DNA_CACHE:\n      LOG.info(\"DatanodeCommand action: DNA_CACHE for \" +\n        blockIdCmd.getBlockPoolId() + \" of [\" +\n          blockIdArrayToString(blockIdCmd.getBlockIds()) + \"]\");\n      dn.getFSDataset().cache(blockIdCmd.getBlockPoolId(), blockIdCmd.getBlockIds());\n      break;\n    case DatanodeProtocol.DNA_UNCACHE:\n      LOG.info(\"DatanodeCommand action: DNA_UNCACHE for \" +\n        blockIdCmd.getBlockPoolId() + \" of [\" +\n          blockIdArrayToString(blockIdCmd.getBlockIds()) + \"]\");\n      dn.getFSDataset().uncache(blockIdCmd.getBlockPoolId(), blockIdCmd.getBlockIds());\n      break;\n    case DatanodeProtocol.DNA_SHUTDOWN:\n      // TODO: DNA_SHUTDOWN appears to be unused - the NN never sends this command\n      // See HDFS-2987.\n      throw new UnsupportedOperationException(\"Received unimplemented DNA_SHUTDOWN\");\n    case DatanodeProtocol.DNA_FINALIZE:\n      String bp = ((FinalizeCommand) cmd).getBlockPoolId();\n      LOG.info(\"Got finalize command for block pool \" + bp);\n      assert getBlockPoolId().equals(bp) :\n        \"BP \" + getBlockPoolId() + \" received DNA_FINALIZE \" +\n        \"for other block pool \" + bp;\n\n      dn.finalizeUpgradeForPool(bp);\n      break;\n    case DatanodeProtocol.DNA_RECOVERBLOCK:\n      String who = \"NameNode at \" + nnSocketAddress;\n      dn.getBlockRecoveryWorker().recoverBlocks(who,\n          ((BlockRecoveryCommand)cmd).getRecoveringBlocks());\n      break;\n    case DatanodeProtocol.DNA_ACCESSKEYUPDATE:\n      LOG.info(\"DatanodeCommand action from active NN {}: DNA_ACCESSKEYUPDATE\", nnSocketAddress);\n      if (dn.isBlockTokenEnabled) {\n        dn.blockPoolTokenSecretManager.addKeys(","sourceCodeStart":755,"sourceCodeEnd":791,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPOfferService.java#L755-L791","documentation":"The DataNode's command dispatcher has a case for DatanodeProtocol.DNA_SHUTDOWN that intentionally throws UnsupportedOperationException — as the code comment notes, the stock NameNode never sends this command (HDFS-2987) and the DN has no handler for it. Receiving it means the peer is not behaving like a stock NN.","triggerScenarios":"A modified/forked NameNode, test harness, or crafted DatanodeProtocol response includes DNA_SHUTDOWN in a heartbeat reply; the DN's actor thread hits the unhandled case and dies.","commonSituations":"In-house NN forks reusing the ancient shutdown command; protocol fuzzing/replay tests; extremely old pre-2.x protocol semantics reused in tooling.","solutions":["Stop sending DNA_SHUTDOWN from custom NN-side code — decommission + stopping the DN process is the supported path","If this comes from a stock NN, capture the NN version and heartbeat trace and file a HADOOP JIRA; it indicates protocol corruption"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Only relevant for custom command dispatchers built on DatanodeProtocol\ntry {\n  processCommands(cmds);\n} catch (UnsupportedOperationException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"DNA_SHUTDOWN\")) {\n    // peer is not a stock NN: log and refuse instead of killing the actor thread\n    LOG.error(\"Peer sent unimplemented DNA_SHUTDOWN; ignoring command source\");\n  } else {\n    throw e;\n  }\n}","preventionTips":["Do not send legacy DNA_SHUTDOWN from custom NN-side code; use decommission and process control","Keep DN and NN protocol versions aligned in mixed-version rollouts"],"tags":["hdfs","datanode","datanodeprotocol","unsupported-command","shutdown"],"backgroundTag":"unsupported-protocol-command","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}