spark-instrumented-optimizer/core
Liwei Lin b2a4560648 [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](37bc203c8d) 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 most recent value.

This patch makes `acquiredButNotUsed` volatile to fix this.

## How was this patch tested?

This should be covered by existing suits.

Author: Liwei Lin <lwlin7@gmail.com>

Closes #12681 from lw-lin/fix-acquiredButNotUsed.
2016-04-26 23:08:40 -07:00
..
src [SPARK-14911] [CORE] Fix a potential data race in TaskMemoryManager 2016-04-26 23:08:40 -07:00
pom.xml [SPARK-14612][ML] Consolidate the version of dependencies in mllib and mllib-local into one place 2016-04-14 10:48:17 -07:00