hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Colin Patrick McCabe (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (HADOOP-11901) BytesWritable supports only up to ~700MB (instead of 2G) due to integer overflow.
Date Fri, 08 May 2015 20:53:00 GMT

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

Colin Patrick McCabe edited comment on HADOOP-11901 at 5/8/15 8:52 PM:
-----------------------------------------------------------------------

Thanks, [~rxin].  How about something like {{Math.min(Integer.MAX_VALUE, (3L * size) / 2L)}}?
 The current patch still causes an overflow if size is near MAX_INT. (edit: thanks to [~sandyr]
for correcting this... I meant min, not max)


was (Author: cmccabe):
Thanks, [~rxin].  How about something like {{Math.max(Integer.MAX_VALUE, (3L * size) / 2L)}}?
 The current patch still causes an overflow if size is near MAX_INT.

> BytesWritable supports only up to ~700MB (instead of 2G) due to integer overflow.
> ---------------------------------------------------------------------------------
>
>                 Key: HADOOP-11901
>                 URL: https://issues.apache.org/jira/browse/HADOOP-11901
>             Project: Hadoop Common
>          Issue Type: Improvement
>            Reporter: Reynold Xin
>            Assignee: Reynold Xin
>              Labels: BB2015-05-TBR
>         Attachments: HADOOP-11901.diff
>
>
> BytesWritable.setSize increases the buffer size by 1.5 each time ( * 3 / 2). This is
an unsafe operation since it restricts the max size to ~700MB, since 700MB * 3 > 2GB.
> I didn't write a test case for this case because in order to trigger this, I'd need to
allocate around 700MB, which is pretty expensive to do in a unit test. Note that I didn't
throw any exception in the case integer overflow as I didn't want to change that behavior
(callers to this might expect a java.lang.NegativeArraySizeException).



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

Mime
View raw message