[ 
https://issues.apache.org/jira/browse/HDFS-5445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14272482#comment-14272482
 ] 

Hadoop QA commented on HDFS-5445:
---------------------------------

{color:red}-1 overall{color}.  Here are the results of testing the latest 
attachment 
  http://issues.apache.org/jira/secure/attachment/12691488/HDFS-5445.001.patch
  against trunk revision a260406.

    {color:green}+1 @author{color}.  The patch does not contain any @author 
tags.

    {color:green}+1 tests included{color}.  The patch appears to include 1 new 
or modified test files.

    {color:green}+1 javac{color}.  The applied patch does not increase the 
total number of javac compiler warnings.

    {color:green}+1 javadoc{color}.  There were no new javadoc warning messages.

    {color:green}+1 eclipse:eclipse{color}.  The patch built with 
eclipse:eclipse.

    {color:green}+1 findbugs{color}.  The patch does not introduce any new 
Findbugs (version 2.0.3) warnings.

    {color:green}+1 release audit{color}.  The applied patch does not increase 
the total number of release audit warnings.

    {color:red}-1 core tests{color}.  The patch failed these unit tests in 
hadoop-hdfs-project/hadoop-hdfs:

                  org.apache.hadoop.hdfs.server.namenode.TestCacheDirectives

Test results: 
https://builds.apache.org/job/PreCommit-HDFS-Build/9180//testReport/
Console output: https://builds.apache.org/job/PreCommit-HDFS-Build/9180//console

This message is automatically generated.

> PacketReceiver populates the packetLen field in PacketHeader incorrectly
> ------------------------------------------------------------------------
>
>                 Key: HDFS-5445
>                 URL: https://issues.apache.org/jira/browse/HDFS-5445
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: datanode
>    Affects Versions: 2.1.0-beta, 2.2.0
>         Environment: Ubuntu 12.10, Hadoop 2.1.0-beta
>            Reporter: Jonathan Mace
>            Priority: Minor
>              Labels: easyfix
>         Attachments: HDFS-5445.001.patch
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> Summary: PacketReceiver reconstructs PacketHeaders with a packetLen 4 bytes 
> fewer than it should be.  It doesn't cause any exceptions because the 
> reconstructed header is never reserialized, and the packetLen field is not 
> used in this part of the code.
> In the BlockSender class, when a Packet is constructed it must be passed the 
> field packetLen, which is defined as the data length, checksum data length, 
> PLUS the length of the packetLen field itself (4 byte integer).
> {code:title=BlockSender.java|borderStyle=solid}
> 484:  private int sendPacket(ByteBuffer pkt, int maxChunks, OutputStream out,
> 485:      boolean transferTo, DataTransferThrottler throttler) throws 
> IOException {
> ...
> 491:    int packetLen = dataLen + checksumDataLen + 4;
> ...
> 504:    int headerLen = writePacketHeader(pkt, dataLen, packetLen);
> ...
> 586:  }
> ...
> 792:  private int writePacketHeader(ByteBuffer pkt, int dataLen, int 
> packetLen) {
> 793:    pkt.clear();
> 794:    // both syncBlock and syncPacket are false
> 795:    PacketHeader header = new PacketHeader(packetLen, offset, seqno,
> 796:        (dataLen == 0), dataLen, false);
> ...
> 802:  }
> {code}
> In the PacketReceiver class, the PacketHeader is reconstructed using the 
> method setFieldsFromData.  However, the 4 bytes for the packetLen field 
> length are missing.
> {code:title=PacketReceiver.java|borderStyle=solid}
> 112:  private void doRead(ReadableByteChannel ch, InputStream in)
> 113:      throws IOException {
> ...
> 136:    int payloadLen = curPacketBuf.getInt();
> ...
> 144:    int dataPlusChecksumLen = payloadLen - Ints.BYTES;
> ...
> 181:    curHeader.setFieldsFromData(dataPlusChecksumLen, headerBuf);
> ...
> 192:  }
> {code}
> The solution would be instead to do:
> {code:title=PacketReceiver.java|borderStyle=solid}
> 181:    curHeader.setFieldsFromData(payloadLen, headerBuf);
> {code}
> I found this because I was making small modifications to the code that 
> exposed this inconsistency.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to