{"record":{"id":"18362ee98b47979e","repo":"apache/hadoop","slug":"a-datanode-is-restarting","errorCode":null,"errorMessage":"A datanode is restarting.","messagePattern":"A datanode is restarting\\.","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DataStreamer.java","lineNumber":1944,"sourceCode":"            checksum4WriteBlock, cachingStrategy.get(), isLazyPersistFile,\n            (targetPinnings != null && targetPinnings[0]), targetPinnings,\n            nodeStorageIDs[0], nodeStorageIDs);\n\n        // receive ack for connect\n        BlockOpResponseProto resp = BlockOpResponseProto.parseFrom(\n            PBHelperClient.vintPrefixed(blockReplyStream));\n        Status pipelineStatus = resp.getStatus();\n        firstBadLink = resp.getFirstBadLink();\n\n        // Got an restart OOB ack.\n        // If a node is already restarting, this status is not likely from\n        // the same node. If it is from a different node, it is not\n        // from the local datanode. Thus it is safe to treat this as a\n        // regular node error.\n        if (PipelineAck.isRestartOOBStatus(pipelineStatus) &&\n            !errorState.isRestartingNode()) {\n          checkRestart = true;\n          throw new IOException(\"A datanode is restarting.\");\n        }\n\n        String logInfo = \"ack with firstBadLink as \" + firstBadLink;\n        DataTransferProtoUtil.checkBlockOpStatus(resp, logInfo);\n\n        assert null == blockStream : \"Previous blockStream unclosed\";\n        blockStream = out;\n        result =  true; // success\n        errorState.resetInternalError();\n        lastException.clear();\n        // remove all restarting nodes from failed nodes list\n        failed.removeAll(restartingNodes);\n        restartingNodes.clear();\n      } catch (IOException ie) {\n        if (!errorState.isRestartingNode()) {\n          LOG.warn(\"Exception in createBlockOutputStream \" + this, ie);\n        }\n        if (ie instanceof InvalidEncryptionKeyException &&","sourceCodeStart":1926,"sourceCodeEnd":1962,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DataStreamer.java#L1926-L1962","documentation":"Error \"A datanode is restarting.\" thrown in apache/hadoop.","triggerScenarios":"During a write, a DataNode in the pipeline reports that it is restarting. The client aborts the current pipeline operation so the block can be recovered or the pipeline rebuilt.","commonSituations":"See trigger scenarios.","solutions":["Wait for the DataNode restart to complete; the client will retry and the pipeline recovers automatically.","Reduce restart frequency or schedule rolling restarts; enable dfs.client.block.write.replace-datanode-on-failure so writes continue on other nodes."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}