You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by bersprockets <gi...@git.apache.org> on 2018/07/27 19:06:50 UTC

[GitHub] spark pull request #21899: [SPARK-24912][SQL] Don't obscure source of OOM du...

GitHub user bersprockets opened a pull request:

    https://github.com/apache/spark/pull/21899

    [SPARK-24912][SQL] Don't obscure source of OOM during broadcast join

    ## What changes were proposed in this pull request?
    
    This PR shows the stack trace of the original OutOfMemoryError that occurs while building or broadcasting a HashedRelation, rather than the stack trace of the newly created OutOfMemoryError that's created during error handling.
    
    Currently, when an OOM occurs while broadcasting a table, the stack trace shows a line in the error handling:
    <pre>
    java.lang.OutOfMemoryError: Not enough memory to build and broadcast the table to all worker nodes. As a workaround, you can either disable broadcast by setting spark.sql.autoBroadcastJoinThreshold to -1 or increase the spark driver memory by setting spark.driver.memory to a higher value
      at org.apache.spark.sql.execution.exchange.BroadcastExchangeExec$$anonfun$relationFuture$1$$anonfun$apply$1.apply(BroadcastExchangeExec.scala:122)
      at org.apache.spark.sql.execution.exchange.BroadcastExchangeExec$$anonfun$relationFuture$1$$anonfun$apply$1.apply(BroadcastExchangeExec.scala:76)
      at org.apache.spark.sql.execution.SQLExecution$$anonfun$withExecutionId$1.apply(SQLExecution.scala:101)
    </pre>
    With this PR, it shows the original stack trace.
    <pre>
    java.lang.OutOfMemoryError: Not enough memory to build and broadcast the table to all worker nodes. As a workaround, you can either disable broadcast by setting spark.sql.autoBroadcastJoinThreshold to -1 or increase the spark driver memory by setting spark.driver.memory to a higher value
      at org.apache.spark.sql.execution.joins.LongToUnsafeRowMap.grow(HashedRelation.scala:628)
      at org.apache.spark.sql.execution.joins.LongToUnsafeRowMap.append(HashedRelation.scala:570)
      at org.apache.spark.sql.execution.joins.LongHashedRelation$.apply(HashedRelation.scala:865)
    </pre>
    
    While sometimes the line on which is the exception is thrown is just a victim, sometimes it is a participant in the problem, as was the case in the above exception.
    
    ## How was this patch tested?
    
    Manually tested case where broadcast join caused an OOM, and a case where it did not.


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

    $ git pull https://github.com/bersprockets/spark SPARK-24912

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

    https://github.com/apache/spark/pull/21899.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 #21899
    
----
commit ca19596c9c09e2cc0ef5667d84f1d289b8184b91
Author: Bruce Robbins <be...@...>
Date:   2018-07-26T01:11:07Z

    Initial commit

----


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #21899: [SPARK-24912][SQL] Don't obscure source of OOM during br...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/21899
  
    **[Test build #95773 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/95773/testReport)** for PR 21899 at commit [`e927cd3`](https://github.com/apache/spark/commit/e927cd3d88a787cbd39fd99cc5afa942d7e955f0).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #21899: [SPARK-24912][SQL] Don't obscure source of OOM during br...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/21899
  
    **[Test build #93687 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/93687/testReport)** for PR 21899 at commit [`ca19596`](https://github.com/apache/spark/commit/ca19596c9c09e2cc0ef5667d84f1d289b8184b91).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #21899: [SPARK-24912][SQL] Don't obscure source of OOM during br...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21899
  
    Merged build finished. Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #21899: [SPARK-24912][SQL] Don't obscure source of OOM du...

Posted by bersprockets <gi...@git.apache.org>.
Github user bersprockets commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21899#discussion_r211833522
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/exchange/BroadcastExchangeExec.scala ---
    @@ -118,12 +119,20 @@ case class BroadcastExchangeExec(
               // SparkFatalException, which is a subclass of Exception. ThreadUtils.awaitResult
               // will catch this exception and re-throw the wrapped fatal throwable.
               case oe: OutOfMemoryError =>
    -            throw new SparkFatalException(
    +            val sizeMessage = if (dataSize != -1) {
    +              s"${SparkLauncher.DRIVER_MEMORY} by at least the estimated size of the " +
    +                s"relation ($dataSize bytes)"
    --- End diff --
    
    Hmmm.. good question. I will check.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #21899: [SPARK-24912][SQL] Don't obscure source of OOM during br...

Posted by squito <gi...@git.apache.org>.
Github user squito commented on the issue:

    https://github.com/apache/spark/pull/21899
  
    lgtm, just a small reword in one of the msgs suggested by maxgekk.
    
    @hvanhovell @gatorsmile would you like to review this as well?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #21899: [SPARK-24912][SQL] Don't obscure source of OOM during br...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21899
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/93687/
    Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #21899: [SPARK-24912][SQL] Don't obscure source of OOM during br...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21899
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/94929/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #21899: [SPARK-24912][SQL] Don't obscure source of OOM during br...

Posted by bersprockets <gi...@git.apache.org>.
Github user bersprockets commented on the issue:

    https://github.com/apache/spark/pull/21899
  
    @MaxGekk In the updated message, I left out "hash" from the term "hash relation" only because it seems the relation could be also be an Array.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #21899: [SPARK-24912][SQL] Don't obscure source of OOM during br...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21899
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/95773/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #21899: [SPARK-24912][SQL] Don't obscure source of OOM during br...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/21899
  
    **[Test build #94929 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/94929/testReport)** for PR 21899 at commit [`829a333`](https://github.com/apache/spark/commit/829a333ad3dc152b90e5257cf67e2134c31e839e).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #21899: [SPARK-24912][SQL] Don't obscure source of OOM du...

Posted by MaxGekk <gi...@git.apache.org>.
Github user MaxGekk commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21899#discussion_r205954659
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/exchange/BroadcastExchangeExec.scala ---
    @@ -118,12 +119,19 @@ case class BroadcastExchangeExec(
               // SparkFatalException, which is a subclass of Exception. ThreadUtils.awaitResult
               // will catch this exception and re-throw the wrapped fatal throwable.
               case oe: OutOfMemoryError =>
    -            throw new SparkFatalException(
    +            val sizeMessage = if (dataSize != -1) {
    +              s"; Size of table is $dataSize"
    --- End diff --
    
    You are taking into account only size of the `relation`.  Probably, result of `child.executeCollectIterator()` consumes some memory too, and an user will need more memory than `dataSize`?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #21899: [SPARK-24912][SQL] Don't obscure source of OOM during br...

Posted by bersprockets <gi...@git.apache.org>.
Github user bersprockets commented on the issue:

    https://github.com/apache/spark/pull/21899
  
    >Is it possible to include the actual size of the in-memory table so far in the msg as well?
    
    Only if the relation can be built. If we run out of memory attempting to build the relation, we've essentially died in its constructor, so the relation doesn't exist.
    
    If we OOM after that (say when attempting to broadcast the relation), then we can get the size.



---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #21899: [SPARK-24912][SQL] Don't obscure source of OOM during br...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21899
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #21899: [SPARK-24912][SQL] Don't obscure source of OOM during br...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21899
  
    Merged build finished. Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #21899: [SPARK-24912][SQL] Don't obscure source of OOM du...

Posted by MaxGekk <gi...@git.apache.org>.
Github user MaxGekk commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21899#discussion_r210664024
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/exchange/BroadcastExchangeExec.scala ---
    @@ -118,12 +119,19 @@ case class BroadcastExchangeExec(
               // SparkFatalException, which is a subclass of Exception. ThreadUtils.awaitResult
               // will catch this exception and re-throw the wrapped fatal throwable.
               case oe: OutOfMemoryError =>
    -            throw new SparkFatalException(
    +            val sizeMessage = if (dataSize != -1) {
    +              s"; Size of table is $dataSize"
    +            } else {
    +              ""
    +            }
    +            val oome =
                   new OutOfMemoryError(s"Not enough memory to build and broadcast the table to " +
                   s"all worker nodes. As a workaround, you can either disable broadcast by setting " +
                   s"${SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key} to -1 or increase the spark driver " +
    -              s"memory by setting ${SparkLauncher.DRIVER_MEMORY} to a higher value")
    -              .initCause(oe.getCause))
    +              s"memory by setting ${SparkLauncher.DRIVER_MEMORY} to a higher value$sizeMessage")
    --- End diff --
    
    My concern is mostly about collect - it fully materialize collected rows in the memory: https://github.com/apache/spark/blob/e0b63832181464453f753649623a24cb567a73d4/sql/core/src/main/scala/org/apache/spark/sql/execution/SparkPlan.scala#L304


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #21899: [SPARK-24912][SQL] Don't obscure source of OOM du...

Posted by MaxGekk <gi...@git.apache.org>.
Github user MaxGekk commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21899#discussion_r206441736
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/exchange/BroadcastExchangeExec.scala ---
    @@ -118,12 +119,19 @@ case class BroadcastExchangeExec(
               // SparkFatalException, which is a subclass of Exception. ThreadUtils.awaitResult
               // will catch this exception and re-throw the wrapped fatal throwable.
               case oe: OutOfMemoryError =>
    -            throw new SparkFatalException(
    +            val sizeMessage = if (dataSize != -1) {
    +              s"; Size of table is $dataSize"
    --- End diff --
    
    > this is still useful info to include in the message, right?
    
    No doubt, I would slightly improve the error message and mention that driver memory should be increased at least by `dataSize` or maybe more. And `Size of table ...` -> `Estimated size of hashed relation ...to be broadcasted`


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #21899: [SPARK-24912][SQL] Don't obscure source of OOM du...

Posted by squito <gi...@git.apache.org>.
Github user squito commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21899#discussion_r210645167
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/exchange/BroadcastExchangeExec.scala ---
    @@ -118,12 +119,19 @@ case class BroadcastExchangeExec(
               // SparkFatalException, which is a subclass of Exception. ThreadUtils.awaitResult
               // will catch this exception and re-throw the wrapped fatal throwable.
               case oe: OutOfMemoryError =>
    -            throw new SparkFatalException(
    +            val sizeMessage = if (dataSize != -1) {
    +              s"; Size of table is $dataSize"
    --- End diff --
    
    +1


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #21899: [SPARK-24912][SQL] Don't obscure source of OOM during br...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/21899
  
    **[Test build #95773 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/95773/testReport)** for PR 21899 at commit [`e927cd3`](https://github.com/apache/spark/commit/e927cd3d88a787cbd39fd99cc5afa942d7e955f0).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #21899: [SPARK-24912][SQL] Don't obscure source of OOM during br...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21899
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/93703/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #21899: [SPARK-24912][SQL] Don't obscure source of OOM during br...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/21899
  
    **[Test build #94929 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/94929/testReport)** for PR 21899 at commit [`829a333`](https://github.com/apache/spark/commit/829a333ad3dc152b90e5257cf67e2134c31e839e).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #21899: [SPARK-24912][SQL] Don't obscure source of OOM during br...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21899
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #21899: [SPARK-24912][SQL] Don't obscure source of OOM during br...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/21899
  
    **[Test build #94907 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/94907/testReport)** for PR 21899 at commit [`829a333`](https://github.com/apache/spark/commit/829a333ad3dc152b90e5257cf67e2134c31e839e).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #21899: [SPARK-24912][SQL] Don't obscure source of OOM during br...

Posted by bersprockets <gi...@git.apache.org>.
Github user bersprockets commented on the issue:

    https://github.com/apache/spark/pull/21899
  
    > Is it possible to include the actual size of the in-memory table so far in the msg as well?
    
    Possibly. The state of the relation might be messy when I go to query its size.
    
    >Also, does catching the OOM and throwing our own mess with HeapDumpOnOutOfMemoryError?
    
    @squito From my tests, it seems the heap dump is taken before the exception is caught.
    
    <pre>
    java.lang.OutOfMemoryError: Java heap space
    Dumping heap to java_pid70644.hprof ...
    Heap dump file created [842225516 bytes in 2.412 secs]
    java.lang.OutOfMemoryError: Not enough memory to build and broadcast the table to all worker nodes. As a workaround, you can either disable broadcast by setting spark.sql.autoBroadcastJoinThreshold to -1 or increase the spark driver memory by setting spark.driver.memory to a higher value
      at org.apache.spark.sql.execution.joins.LongToUnsafeRowMap.grow(HashedRelation.scala:628)
    </pre>


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #21899: [SPARK-24912][SQL] Don't obscure source of OOM during br...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/21899
  
    **[Test build #94910 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/94910/testReport)** for PR 21899 at commit [`829a333`](https://github.com/apache/spark/commit/829a333ad3dc152b90e5257cf67e2134c31e839e).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #21899: [SPARK-24912][SQL] Don't obscure source of OOM du...

Posted by rezasafi <gi...@git.apache.org>.
Github user rezasafi commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21899#discussion_r211825377
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/exchange/BroadcastExchangeExec.scala ---
    @@ -118,12 +119,20 @@ case class BroadcastExchangeExec(
               // SparkFatalException, which is a subclass of Exception. ThreadUtils.awaitResult
               // will catch this exception and re-throw the wrapped fatal throwable.
               case oe: OutOfMemoryError =>
    -            throw new SparkFatalException(
    +            val sizeMessage = if (dataSize != -1) {
    +              s"${SparkLauncher.DRIVER_MEMORY} by at least the estimated size of the " +
    +                s"relation ($dataSize bytes)"
    --- End diff --
    
    How accurate is the datasize? Just worried that it becomes misleading


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #21899: [SPARK-24912][SQL] Don't obscure source of OOM during br...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21899
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/94907/
    Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #21899: [SPARK-24912][SQL] Don't obscure source of OOM du...

Posted by squito <gi...@git.apache.org>.
Github user squito commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21899#discussion_r206327279
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/exchange/BroadcastExchangeExec.scala ---
    @@ -118,12 +119,19 @@ case class BroadcastExchangeExec(
               // SparkFatalException, which is a subclass of Exception. ThreadUtils.awaitResult
               // will catch this exception and re-throw the wrapped fatal throwable.
               case oe: OutOfMemoryError =>
    -            throw new SparkFatalException(
    +            val sizeMessage = if (dataSize != -1) {
    +              s"; Size of table is $dataSize"
    --- End diff --
    
    I think you're right @MaxGekk.  I was thinking there was a MemoryManager involved here, and you could query its size, but now I see thats only in `HashedRelation.apply()`.
    
    Nonetheless -- this is still useful info to include in the message, right?  It would be better if we accurately tracked the total size needed, but this is still helpful.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #21899: [SPARK-24912][SQL] Don't obscure source of OOM during br...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21899
  
    Can one of the admins verify this patch?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #21899: [SPARK-24912][SQL] Don't obscure source of OOM during br...

Posted by bersprockets <gi...@git.apache.org>.
Github user bersprockets commented on the issue:

    https://github.com/apache/spark/pull/21899
  
    retest this please


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #21899: [SPARK-24912][SQL] Don't obscure source of OOM during br...

Posted by squito <gi...@git.apache.org>.
Github user squito commented on the issue:

    https://github.com/apache/spark/pull/21899
  
    this looks good -- wondering about a couple of potential improvements.  Is it possible to include the actual size of the in-memory table so far in the msg as well?
    
    Also, does catching the OOM and throwing our own mess with HeapDumpOnOutOfMemoryError?  Or does that flag still work?  I know you got some heap dumps but I just wanted to check that you didn't need to rip out the try-catch completely for that to work.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #21899: [SPARK-24912][SQL] Don't obscure source of OOM during br...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21899
  
    Can one of the admins verify this patch?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #21899: [SPARK-24912][SQL] Don't obscure source of OOM du...

Posted by bersprockets <gi...@git.apache.org>.
Github user bersprockets commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21899#discussion_r211047556
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/exchange/BroadcastExchangeExec.scala ---
    @@ -118,12 +119,20 @@ case class BroadcastExchangeExec(
               // SparkFatalException, which is a subclass of Exception. ThreadUtils.awaitResult
               // will catch this exception and re-throw the wrapped fatal throwable.
               case oe: OutOfMemoryError =>
    -            throw new SparkFatalException(
    +            val sizeMessage = if (dataSize != -1) {
    +              s"${SparkLauncher.DRIVER_MEMORY} by at least the estimated size of the " +
    --- End diff --
    
    @hvanhovell That's what was being obscured :).
    
    In testing this, I've seen various places. In the three cases I have seen first hand:
    
    <pre>
    java.lang.OutOfMemoryError: Not enough memory to build and broadcast the table to all worker nodes. As a workaround, you can either disable broadcast by setting spark.sql.autoBroadcastJoinThreshold to -1 or increase the spark driver memory by setting spark.driver.memory to a higher value.
      at org.apache.spark.sql.execution.joins.LongToUnsafeRowMap.grow(HashedRelation.scala:628)
      at org.apache.spark.sql.execution.joins.LongToUnsafeRowMap.append(HashedRelation.scala:570)
      at org.apache.spark.sql.execution.joins.LongHashedRelation$.apply(HashedRelation.scala:865)
    </pre>
    At that line is an allocation:
    <pre>
    val newPage = new Array[Long](newNumWords.toInt)
    </pre>
    2nd case:
    <pre>
    java.lang.OutOfMemoryError: Not enough memory to build and broadcast the table to all worker nodes. As a workaround, you can either disable broadcast by setting spark.sql.autoBroadcastJoinThreshold to -1 or increase spark.driver.memory by at least the estimated size of the relation (96468992 bytes).
      at java.nio.HeapByteBuffer.(HeapByteBuffer.java:57)
      at java.nio.ByteBuffer.allocate(ByteBuffer.java:335)
      at org.apache.spark.broadcast.TorrentBroadcast$$anonfun$3.apply(TorrentBroadcast.scala:286)
      at org.apache.spark.broadcast.TorrentBroadcast$$anonfun$3.apply(TorrentBroadcast.scala:286)
    </pre>
    3rd case:
    <pre>
    java.lang.OutOfMemoryError: Not enough memory to build and broadcast the table to all worker nodes. As a workaround, you can either disable broadcast by setting \
    spark.sql.autoBroadcastJoinThreshold to -1 or increase the spark driver memory by setting spark.driver.memory to a higher value.
      at org.apache.spark.unsafe.memory.MemoryBlock.allocateFromObject(MemoryBlock.java:118)
      at org.apache.spark.sql.catalyst.expressions.UnsafeRow.getUTF8String(UnsafeRow.java:420)
      at org.apache.spark.sql.catalyst.expressions.GeneratedClass$SpecificUnsafeProjection.apply(Unknown Source)
      at org.apache.spark.sql.execution.joins.UnsafeHashedRelation$.apply(HashedRelation.scala:311)
    </pre>
    At that line is also an allocation:
    <pre>
    mb = new ByteArrayMemoryBlock(array, offset, length);
    </pre>
    



---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #21899: [SPARK-24912][SQL] Don't obscure source of OOM during br...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21899
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/94910/
    Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #21899: [SPARK-24912][SQL] Don't obscure source of OOM during br...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/21899
  
    **[Test build #94910 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/94910/testReport)** for PR 21899 at commit [`829a333`](https://github.com/apache/spark/commit/829a333ad3dc152b90e5257cf67e2134c31e839e).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #21899: [SPARK-24912][SQL] Don't obscure source of OOM during br...

Posted by bersprockets <gi...@git.apache.org>.
Github user bersprockets commented on the issue:

    https://github.com/apache/spark/pull/21899
  
    retest this please


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #21899: [SPARK-24912][SQL] Don't obscure source of OOM du...

Posted by squito <gi...@git.apache.org>.
Github user squito commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21899#discussion_r210647464
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/exchange/BroadcastExchangeExec.scala ---
    @@ -118,12 +119,19 @@ case class BroadcastExchangeExec(
               // SparkFatalException, which is a subclass of Exception. ThreadUtils.awaitResult
               // will catch this exception and re-throw the wrapped fatal throwable.
               case oe: OutOfMemoryError =>
    -            throw new SparkFatalException(
    +            val sizeMessage = if (dataSize != -1) {
    +              s"; Size of table is $dataSize"
    +            } else {
    +              ""
    +            }
    +            val oome =
                   new OutOfMemoryError(s"Not enough memory to build and broadcast the table to " +
                   s"all worker nodes. As a workaround, you can either disable broadcast by setting " +
                   s"${SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key} to -1 or increase the spark driver " +
    -              s"memory by setting ${SparkLauncher.DRIVER_MEMORY} to a higher value")
    -              .initCause(oe.getCause))
    +              s"memory by setting ${SparkLauncher.DRIVER_MEMORY} to a higher value$sizeMessage")
    --- End diff --
    
    I'm a bit hesitant to suggest exactly what value to say here, as we don't actually know how close we were to having it all fit.  I tried to come up with something useful to say here which would be accurate and succinct, but felt it either got too convoluted, or might only lead to more confusion as it was too simplistic.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #21899: [SPARK-24912][SQL] Don't obscure source of OOM during br...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/21899
  
    **[Test build #94907 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/94907/testReport)** for PR 21899 at commit [`829a333`](https://github.com/apache/spark/commit/829a333ad3dc152b90e5257cf67e2134c31e839e).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #21899: [SPARK-24912][SQL] Don't obscure source of OOM during br...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/21899
  
    **[Test build #93703 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/93703/testReport)** for PR 21899 at commit [`ca94f64`](https://github.com/apache/spark/commit/ca94f64afa2cb64ccac73814c9e941a0a3c960a9).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #21899: [SPARK-24912][SQL] Don't obscure source of OOM du...

Posted by hvanhovell <gi...@git.apache.org>.
Github user hvanhovell commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21899#discussion_r211044133
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/exchange/BroadcastExchangeExec.scala ---
    @@ -118,12 +119,20 @@ case class BroadcastExchangeExec(
               // SparkFatalException, which is a subclass of Exception. ThreadUtils.awaitResult
               // will catch this exception and re-throw the wrapped fatal throwable.
               case oe: OutOfMemoryError =>
    -            throw new SparkFatalException(
    +            val sizeMessage = if (dataSize != -1) {
    +              s"${SparkLauncher.DRIVER_MEMORY} by at least the estimated size of the " +
    --- End diff --
    
    Forgive me for asking a dumb question, but where will this exception come from? The block manager?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #21899: [SPARK-24912][SQL] Don't obscure source of OOM during br...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/21899
  
    **[Test build #93703 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/93703/testReport)** for PR 21899 at commit [`ca94f64`](https://github.com/apache/spark/commit/ca94f64afa2cb64ccac73814c9e941a0a3c960a9).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #21899: [SPARK-24912][SQL] Don't obscure source of OOM during br...

Posted by bersprockets <gi...@git.apache.org>.
Github user bersprockets commented on the issue:

    https://github.com/apache/spark/pull/21899
  
    cc @jinxing64 @hvanhovell  @MaxGekk 


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #21899: [SPARK-24912][SQL] Don't obscure source of OOM during br...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/21899
  
    **[Test build #93687 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/93687/testReport)** for PR 21899 at commit [`ca19596`](https://github.com/apache/spark/commit/ca19596c9c09e2cc0ef5667d84f1d289b8184b91).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #21899: [SPARK-24912][SQL] Don't obscure source of OOM during br...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21899
  
    Merged build finished. Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #21899: [SPARK-24912][SQL] Don't obscure source of OOM du...

Posted by bersprockets <gi...@git.apache.org>.
Github user bersprockets commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21899#discussion_r212756302
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/exchange/BroadcastExchangeExec.scala ---
    @@ -118,12 +119,20 @@ case class BroadcastExchangeExec(
               // SparkFatalException, which is a subclass of Exception. ThreadUtils.awaitResult
               // will catch this exception and re-throw the wrapped fatal throwable.
               case oe: OutOfMemoryError =>
    -            throw new SparkFatalException(
    +            val sizeMessage = if (dataSize != -1) {
    +              s"${SparkLauncher.DRIVER_MEMORY} by at least the estimated size of the " +
    +                s"relation ($dataSize bytes)"
    --- End diff --
    
    @rezasafi The dataSize appears to be inflated by 2-3 times, at least relative to the size of the actual data in the table. That may be because these relations are backed by map-like objects that have keys and (likely) other internal structures.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #21899: [SPARK-24912][SQL] Don't obscure source of OOM during br...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21899
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #21899: [SPARK-24912][SQL] Don't obscure source of OOM du...

Posted by MaxGekk <gi...@git.apache.org>.
Github user MaxGekk commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21899#discussion_r206442258
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/exchange/BroadcastExchangeExec.scala ---
    @@ -118,12 +119,19 @@ case class BroadcastExchangeExec(
               // SparkFatalException, which is a subclass of Exception. ThreadUtils.awaitResult
               // will catch this exception and re-throw the wrapped fatal throwable.
               case oe: OutOfMemoryError =>
    -            throw new SparkFatalException(
    +            val sizeMessage = if (dataSize != -1) {
    +              s"; Size of table is $dataSize"
    +            } else {
    +              ""
    +            }
    +            val oome =
                   new OutOfMemoryError(s"Not enough memory to build and broadcast the table to " +
                   s"all worker nodes. As a workaround, you can either disable broadcast by setting " +
                   s"${SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key} to -1 or increase the spark driver " +
    -              s"memory by setting ${SparkLauncher.DRIVER_MEMORY} to a higher value")
    -              .initCause(oe.getCause))
    +              s"memory by setting ${SparkLauncher.DRIVER_MEMORY} to a higher value$sizeMessage")
    --- End diff --
    
    I would roughly doubled the recommended size 


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org