aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorlisurprise <zhichao.li@intel.com>2015-04-12 13:41:44 +0100
committerSean Owen <sowen@cloudera.com>2015-04-12 13:41:44 +0100
commitddc17431a4108ab6efe0cd329d69e1f2fca5ac12 (patch)
treecef664b23999f2af70ef30a964e5d4ddc2d844f1 /core
parente9445b187e8f5c3703771b775e60164166309570 (diff)
downloadspark-ddc17431a4108ab6efe0cd329d69e1f2fca5ac12.tar.gz
spark-ddc17431a4108ab6efe0cd329d69e1f2fca5ac12.tar.bz2
spark-ddc17431a4108ab6efe0cd329d69e1f2fca5ac12.zip
[SPARK-6843][core]Add volatile for the "state"
Fix potential visibility problem for the "state" of Executor The field of "state" is shared and modified by multiple threads. i.e: ```scala Within ExecutorRunner.scala (1) workerThread = new Thread("ExecutorRunner for " + fullId) { override def run() { fetchAndRunExecutor() } } workerThread.start() // Shutdown hook that kills actors on shutdown. (2)shutdownHook = new Thread() { override def run() { killProcess(Some("Worker shutting down")) } } (3)and also the "Actor thread" for worker. ``` I think we should at lease add volatile to ensure the visibility among threads otherwise the worker might send an out-of-date status to the master. https://issues.apache.org/jira/browse/SPARK-6843 Author: lisurprise <zhichao.li@intel.com> Closes #5448 from zhichao-li/state and squashes the following commits: a2386e7 [lisurprise] add volatile for state field
Diffstat (limited to 'core')
-rw-r--r--core/src/main/scala/org/apache/spark/deploy/worker/ExecutorRunner.scala2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/src/main/scala/org/apache/spark/deploy/worker/ExecutorRunner.scala b/core/src/main/scala/org/apache/spark/deploy/worker/ExecutorRunner.scala
index 83e24a7a1f..7d5acabb95 100644
--- a/core/src/main/scala/org/apache/spark/deploy/worker/ExecutorRunner.scala
+++ b/core/src/main/scala/org/apache/spark/deploy/worker/ExecutorRunner.scala
@@ -50,7 +50,7 @@ private[deploy] class ExecutorRunner(
val workerUrl: String,
conf: SparkConf,
val appLocalDirs: Seq[String],
- var state: ExecutorState.Value)
+ @volatile var state: ExecutorState.Value)
extends Logging {
private val fullId = appId + "/" + execId