GitHub user lw-lin opened a pull request:

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

    [SPARK-14911][Core] Fix a potential data race in TaskMemoryManager

    ## What changes were proposed in this pull request?
    
    [[SPARK-13210][SQL] catch OOM when allocate memory and expand 
array](https://github.com/apache/spark/commit/37bc203c8dd5022cb11d53b697c28a737ee85bcc)
 introduced an `acquiredButNotUsed` field, but it might not be correctly 
synchronized:
    - the write `acquiredButNotUsed += acquired` is guarded by `this` lock (see 
[here](https://github.com/apache/spark/blame/master/core/src/main/java/org/apache/spark/memory/TaskMemoryManager.java#L271));
    - the read `memoryManager.releaseExecutionMemory(acquiredButNotUsed, 
taskAttemptId, tungstenMemoryMode)` (see 
[here](https://github.com/apache/spark/blame/master/core/src/main/java/org/apache/spark/memory/TaskMemoryManager.java#L400))
 might not be correctly synchronized, and thus might not see 
`acquiredButNotUsed`'s new written value.
    
    This patch makes `acquiredButNotUsed` to fix this.
    
    ## How was this patch tested?
    
    This should be covered by existing suits.


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

    $ git pull https://github.com/lw-lin/spark fix-acquiredButNotUsed

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

    https://github.com/apache/spark/pull/12681.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 #12681
    
----
commit 6b72b963d54855771dcabc1fca8ed963be28303c
Author: Liwei Lin <lwl...@gmail.com>
Date:   2016-04-26T03:11:53Z

    fix a potential data race in TaskMemoryManager

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to