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

Andy Isaacson commented on HDFS-3456:
-------------------------------------

.003.patch uses nextDouble, which does not provide enough entropy -- there are 
only 53 bits in the mantissa of a double.  So if I ask for 60-bit random 
values, it will return a 60-bit value with 7 zero bits at the bottom.  (Or 
something like that -- I didn't test the specific failure mode.)

I am not aware of any easy way to implement nextRandomLong given only a 31-bit 
nextInt.  So, I would suggest to address the potential overflow in 
scheduleBlockReport -- either use nextDouble directly, or limit the maximum 
range to Integer.MAX_VALUE.
                
> blockReportInterval is long value but when we take the random value it uses 
> getRandom().nextInt,it is causing frequently BR
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HDFS-3456
>                 URL: https://issues.apache.org/jira/browse/HDFS-3456
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: data-node
>    Affects Versions: 2.0.0-alpha
>            Reporter: Brahma Reddy Battula
>            Assignee: Colin Patrick McCabe
>            Priority: Minor
>         Attachments: HDFS-3456.001.patch, HDFS-3456.002.patch, 
> HDFS-3456.003.patch
>
>
> blockReportInterval is long value but when we take the random value it uses 
> getRandom().nextInt.
> Due to this, offerService can throw exception as long may get rotated to 
> negative value.
> So, block report may send very frequently.
> {code}
>       if (resetBlockReportTime) {
>         lastBlockReport = startTime - 
> DFSUtil.getRandom().nextInt((int)(dnConf.blockReportInterval));
>       resetBlockReportTime = false;
> {code}

--
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

        

Reply via email to