[
https://issues.apache.org/jira/browse/HDFS-12393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16153549#comment-16153549
]
legend edited comment on HDFS-12393 at 9/5/17 12:20 PM:
--------------------------------------------------------
Thanks [~drankye] for review.
That's right, the allocated packet buffer size is correct.
But the check does not work. I think the {{totalLen }}indicates the size of the
packet.
{quote} // Sanity check the buffer size so we don't allocate too much memory
// and OOME.
int totalLen = payloadLen + headerLen;
if (totalLen < 0 || totalLen > MAX_PACKET_SIZE) {
throw new IOException("Incorrect value for packet payload size: " +
payloadLen);
}{quote}
The package structure is as follows.
{quote} // Each packet looks like:
// PLEN HLEN HEADER CHECKSUMS DATA
// 32-bit 16-bit <protobuf> <variable length>{quote}
So we should make sure that the check is an accurate check.
was (Author: legend):
Thanks [~drankye] for review.
That's right, the allocated packet buffer size is correct.
But the check does not work. I think the {{totalLen }}indicates the size of the
packet.
{{ // Sanity check the buffer size so we don't allocate too much memory
// and OOME.
int totalLen = payloadLen + headerLen;
if (totalLen < 0 || totalLen > MAX_PACKET_SIZE) {
throw new IOException("Incorrect value for packet payload size: " +
payloadLen);
}}}
The package structure is as follows.
{{ // Each packet looks like:
// PLEN HLEN HEADER CHECKSUMS DATA
// 32-bit 16-bit <protobuf> <variable length>}}
So we should make sure that the check is an accurate check.
> Fix incorrect package length for doRead in PacketReceiver
> ---------------------------------------------------------
>
> Key: HDFS-12393
> URL: https://issues.apache.org/jira/browse/HDFS-12393
> Project: Hadoop HDFS
> Issue Type: Bug
> Components: hdfs-client
> Affects Versions: 3.0.0-alpha4
> Reporter: legend
> Assignee: legend
> Labels: patch
> Attachments: HDFS-12393.001.patch
>
>
> {{headerLen=length(HEADER)}}
> {{payloadLen=length(PLEN) + length(CHECKSUMS) + length(DATA)}}
> So {{totalLen = payloadLen + headerLen + length(HLEN)}}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]