Return-Path: X-Original-To: apmail-hadoop-hdfs-issues-archive@minotaur.apache.org Delivered-To: apmail-hadoop-hdfs-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EB91D9AB6 for ; Sun, 20 Nov 2011 03:06:17 +0000 (UTC) Received: (qmail 60415 invoked by uid 500); 20 Nov 2011 03:06:17 -0000 Delivered-To: apmail-hadoop-hdfs-issues-archive@hadoop.apache.org Received: (qmail 60363 invoked by uid 500); 20 Nov 2011 03:06:17 -0000 Mailing-List: contact hdfs-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hdfs-issues@hadoop.apache.org Delivered-To: mailing list hdfs-issues@hadoop.apache.org Received: (qmail 60350 invoked by uid 99); 20 Nov 2011 03:06:16 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 20 Nov 2011 03:06:16 +0000 X-ASF-Spam-Status: No, hits=-2001.2 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 20 Nov 2011 03:06:15 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id EB06A8ECA4 for ; Sun, 20 Nov 2011 03:05:54 +0000 (UTC) Date: Sun, 20 Nov 2011 03:05:54 +0000 (UTC) From: "Hudson (Commented) (JIRA)" To: hdfs-issues@hadoop.apache.org Message-ID: <1103919432.48090.1321758354964.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <2096213992.2675.1320482331565.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (HDFS-2541) For a sufficiently large value of blocks, the DN Scanner may request a random number with a negative seed value. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HDFS-2541?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13153649#comment-13153649 ] Hudson commented on HDFS-2541: ------------------------------ Integrated in Hadoop-Hdfs-trunk-Commit #1361 (See [https://builds.apache.org/job/Hadoop-Hdfs-trunk-Commit/1361/]) HDFS-2541. For a sufficiently large value of blocks, the DN Scanner may request a random number with a negative seed value. Contributed by Harsh J eli : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1204114 Files : * /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt * /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockPoolSliceScanner.java > For a sufficiently large value of blocks, the DN Scanner may request a random number with a negative seed value. > ---------------------------------------------------------------------------------------------------------------- > > Key: HDFS-2541 > URL: https://issues.apache.org/jira/browse/HDFS-2541 > Project: Hadoop HDFS > Issue Type: Bug > Components: data-node > Affects Versions: 0.20.1 > Reporter: Harsh J > Assignee: Harsh J > Fix For: 0.20.206.0, 0.23.1 > > Attachments: BSBugTest.java, HDFS-2541.patch > > > Running off 0.20-security, I noticed that one could get the following exception when scanners are used: > {code} > DataXceiver > java.lang.IllegalArgumentException: n must be positive > at java.util.Random.nextInt(Random.java:250) > at org.apache.hadoop.hdfs.server.datanode.DataBlockScanner.getNewBlockScanTime(DataBlockScanner.java:251) > at org.apache.hadoop.hdfs.server.datanode.DataBlockScanner.addBlock(DataBlockScanner.java:268) > at org.apache.hadoop.hdfs.server.datanode.DataXceiver.writeBlock(DataXceiver.java:432) > at org.apache.hadoop.hdfs.server.datanode.DataXceiver.run(DataXceiver.java:122) > {code} > This is cause the period, determined in the DataBlockScanner (0.20+) or BlockPoolSliceScanner (0.23+), is cast to an integer before its sent to a Random.nextInt(...) call. For sufficiently large values of the long 'period', the casted integer may be negative. This is not accounted for. I'll attach a sample test that shows this possibility with the numbers. > We should ensure we do a Math.abs(...) before we send it to the Random.nextInt(...) call to avoid this. > With this bug, the maximum # of blocks a scanner may hold in its blocksMap without opening up the chance for beginning this exception (intermittent, as blocks continue to grow) would be 3582718. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira