[ 
https://issues.apache.org/jira/browse/SPARK-20280?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Bogdan Raducanu updated SPARK-20280:
------------------------------------
    Description: 
in FileStatusCache.scala:
{code}
    .weigher(new Weigher[(ClientId, Path), Array[FileStatus]] {
      override def weigh(key: (ClientId, Path), value: Array[FileStatus]): Int 
= {
        (SizeEstimator.estimate(key) + SizeEstimator.estimate(value)).toInt
      }})
{code}

Weigher.weigh returns Int but the size of an Array[FileStatus] could be bigger 
than Int.maxValue. Then, a negative value is returned, leading to this 
exception:

{code}
* [info]   java.lang.IllegalStateException: Weights must be non-negative
* [info]   at 
com.google.common.base.Preconditions.checkState(Preconditions.java:149)
* [info]   at 
com.google.common.cache.LocalCache$Segment.setValue(LocalCache.java:2223)
* [info]   at 
com.google.common.cache.LocalCache$Segment.put(LocalCache.java:2944)
* [info]   at com.google.common.cache.LocalCache.put(LocalCache.java:4212)
* [info]   at 
com.google.common.cache.LocalCache$LocalManualCache.put(LocalCache.java:4804)
* [info]   at 
org.apache.spark.sql.execution.datasources.SharedInMemoryCache$$anon$3.putLeafFiles(FileStatusCache.scala:131)

{code}

  was:
{code}
    .weigher(new Weigher[(ClientId, Path), Array[FileStatus]] {
      override def weigh(key: (ClientId, Path), value: Array[FileStatus]): Int 
= {
        (SizeEstimator.estimate(key) + SizeEstimator.estimate(value)).toInt
      }})
{code}

Weigher.weigh returns Int but the size of an Array[FileStatus] could be bigger 
than Int.maxValue. Then, a negative value is returned, leading to this 
exception:

{code}
* [info]   java.lang.IllegalStateException: Weights must be non-negative
* [info]   at 
com.google.common.base.Preconditions.checkState(Preconditions.java:149)
* [info]   at 
com.google.common.cache.LocalCache$Segment.setValue(LocalCache.java:2223)
* [info]   at 
com.google.common.cache.LocalCache$Segment.put(LocalCache.java:2944)
* [info]   at com.google.common.cache.LocalCache.put(LocalCache.java:4212)
* [info]   at 
com.google.common.cache.LocalCache$LocalManualCache.put(LocalCache.java:4804)
* [info]   at 
org.apache.spark.sql.execution.datasources.SharedInMemoryCache$$anon$3.putLeafFiles(FileStatusCache.scala:131)

{code}


> SharedInMemoryCache Weigher integer overflow
> --------------------------------------------
>
>                 Key: SPARK-20280
>                 URL: https://issues.apache.org/jira/browse/SPARK-20280
>             Project: Spark
>          Issue Type: Bug
>          Components: Spark Core
>    Affects Versions: 2.1.0, 2.2.0
>            Reporter: Bogdan Raducanu
>
> in FileStatusCache.scala:
> {code}
>     .weigher(new Weigher[(ClientId, Path), Array[FileStatus]] {
>       override def weigh(key: (ClientId, Path), value: Array[FileStatus]): 
> Int = {
>         (SizeEstimator.estimate(key) + SizeEstimator.estimate(value)).toInt
>       }})
> {code}
> Weigher.weigh returns Int but the size of an Array[FileStatus] could be 
> bigger than Int.maxValue. Then, a negative value is returned, leading to this 
> exception:
> {code}
> * [info]   java.lang.IllegalStateException: Weights must be non-negative
> * [info]   at 
> com.google.common.base.Preconditions.checkState(Preconditions.java:149)
> * [info]   at 
> com.google.common.cache.LocalCache$Segment.setValue(LocalCache.java:2223)
> * [info]   at 
> com.google.common.cache.LocalCache$Segment.put(LocalCache.java:2944)
> * [info]   at com.google.common.cache.LocalCache.put(LocalCache.java:4212)
> * [info]   at 
> com.google.common.cache.LocalCache$LocalManualCache.put(LocalCache.java:4804)
> * [info]   at 
> org.apache.spark.sql.execution.datasources.SharedInMemoryCache$$anon$3.putLeafFiles(FileStatusCache.scala:131)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to