Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id D40F5200D0C for ; Tue, 5 Sep 2017 14:21:11 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id D2C1016248A; Tue, 5 Sep 2017 12:21:11 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 266EB1624C7 for ; Tue, 5 Sep 2017 14:21:11 +0200 (CEST) Received: (qmail 68695 invoked by uid 500); 5 Sep 2017 12:21:10 -0000 Mailing-List: contact hdfs-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list hdfs-issues@hadoop.apache.org Received: (qmail 68684 invoked by uid 99); 5 Sep 2017 12:21:09 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Sep 2017 12:21:09 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 627741A2D68 for ; Tue, 5 Sep 2017 12:21:09 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id fV1sVMqmwh8A for ; Tue, 5 Sep 2017 12:21:04 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 62E1D6103F for ; Tue, 5 Sep 2017 12:21:04 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id DE128E00C9 for ; Tue, 5 Sep 2017 12:21:02 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 7DBFB2414F for ; Tue, 5 Sep 2017 12:21:00 +0000 (UTC) Date: Tue, 5 Sep 2017 12:21:00 +0000 (UTC) From: "legend (JIRA)" To: hdfs-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (HDFS-12393) Fix incorrect package length for doRead in PacketReceiver MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 05 Sep 2017 12:21:12 -0000 [ 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 {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 }} 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: hdfs-issues-unsubscribe@hadoop.apache.org For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org