{"record":{"id":"8448eefdc03e462a","repo":"apache/hadoop","slug":"received-an-out-of-sequence-packet-for-from-a","errorCode":null,"errorMessage":"Received an out-of-sequence packet for {}from {} at offset {}. Expecting packet starting at {}","messagePattern":"Received an out-of-sequence packet for (.+?)from (.+?) at offset (.+?)\\. Expecting packet starting at (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockReceiver.java","lineNumber":563,"sourceCode":"    return (mirrorOut == null || isDatanode || needsChecksumTranslation);\n  }\n\n  /** \n   * Receives and processes a packet. It can contain many chunks.\n   * returns the number of data bytes that the packet has.\n   */\n  private int receivePacket() throws IOException {\n    // read the next packet\n    packetReceiver.receiveNextPacket(in);\n\n    PacketHeader header = packetReceiver.getHeader();\n    long seqno = header.getSeqno();\n    LOG.debug(\"Receiving one packet for block {} seqno:{} header:{} \", block,\n        seqno, header);\n\n    // Sanity check the header\n    if (header.getOffsetInBlock() > replicaInfo.getNumBytes()) {\n      throw new IOException(\"Received an out-of-sequence packet for \" + block + \n          \"from \" + inAddr + \" at offset \" + header.getOffsetInBlock() +\n          \". Expecting packet starting at \" + replicaInfo.getNumBytes());\n    }\n    if (header.getDataLen() < 0) {\n      throw new IOException(\"Got wrong length during writeBlock(\" + block + \n                            \") from \" + inAddr + \" at offset \" + \n                            header.getOffsetInBlock() + \": \" +\n                            header.getDataLen()); \n    }\n\n    long offsetInBlock = header.getOffsetInBlock();\n    boolean lastPacketInBlock = header.isLastPacketInBlock();\n    final int len = header.getDataLen();\n    boolean syncBlock = header.getSyncBlock();\n\n    // avoid double sync'ing on close\n    if (syncBlock && lastPacketInBlock) {\n      this.syncOnClose = false;","sourceCodeStart":545,"sourceCodeEnd":581,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockReceiver.java#L545-L581","documentation":"Error \"Received an out-of-sequence packet for {}from {} at offset {}. Expecting packet starting at {}\" thrown in apache/hadoop.","triggerScenarios":"A write pipeline packet arrives whose offset does not equal the next expected offset, indicating packet loss, reordering, or a client retransmission bug.","commonSituations":"Packets arrived out of order on the write pipeline, usually from a retried or duplicated client send after a network error. Let the client retry; the pipeline recovers.","solutions":["Check network reliability between the client/upstream DataNode and this DataNode; dropped or reordered packets cause out-of-sequence offsets.","If caused by a flaky client or congested network, retry the write; persistent occurrences warrant investigating the TCP path and switch/NIC errors."],"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"}