hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HADOOP-15524) BytesWritable causes OOME when array size reaches Integer.MAX_VALUE
Date Wed, 13 Jun 2018 15:43:00 GMT

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

ASF GitHub Bot commented on HADOOP-15524:
-----------------------------------------

GitHub user jsmithe opened a pull request:

    https://github.com/apache/hadoop/pull/393

    HADOOP-15524 Bounding array size in BytesWritable to Integer.MAX_VALUE - 8

    Bounding array size to Integer.MAX_VALUE - 8 to prevent OutOfMemoryError from occurring.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jsmithe/hadoop trunk

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/hadoop/pull/393.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #393
    
----

----


> BytesWritable causes OOME when array size reaches Integer.MAX_VALUE
> -------------------------------------------------------------------
>
>                 Key: HADOOP-15524
>                 URL: https://issues.apache.org/jira/browse/HADOOP-15524
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: io
>            Reporter: Joseph Smith
>            Priority: Major
>
> BytesWritable.setSize uses Integer.MAX_VALUE to initialize the internal array.  On
my environment, this causes an OOME
> {code:java}
> Exception in thread "main" java.lang.OutOfMemoryError: Requested array size exceeds VM
limit
> {code}
> byte[Integer.MAX_VALUE-2] must be used to prevent this error.
> Tested on OSX and CentOS 7 using Java version 1.8.0_131.
> I noticed that java.util.ArrayList contains the following
> {code:java}
> /**
>  * The maximum size of array to allocate.
>  * Some VMs reserve some header words in an array.
>  * Attempts to allocate larger arrays may result in
>  * OutOfMemoryError: Requested array size exceeds VM limit
>  */
> private static final int MAX_ARRAY_SIZE = Integer.MAX_VALUE - 8;
> {code}
>  
> BytesWritable.setSize should use something similar to prevent an OOME from occurring.
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org


Mime
View raw message