You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by sr...@apache.org on 2015/04/12 14:41:48 UTC
spark git commit: [SPARK-6843][core]Add volatile for the "state"
Repository: spark
Updated Branches:
refs/heads/master e9445b187 -> ddc17431a
[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 <zh...@intel.com>
Closes #5448 from zhichao-li/state and squashes the following commits:
a2386e7 [lisurprise] add volatile for state field
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/ddc17431
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/ddc17431
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/ddc17431
Branch: refs/heads/master
Commit: ddc17431a4108ab6efe0cd329d69e1f2fca5ac12
Parents: e9445b1
Author: lisurprise <zh...@intel.com>
Authored: Sun Apr 12 13:41:44 2015 +0100
Committer: Sean Owen <so...@cloudera.com>
Committed: Sun Apr 12 13:41:44 2015 +0100
----------------------------------------------------------------------
.../main/scala/org/apache/spark/deploy/worker/ExecutorRunner.scala | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/ddc17431/core/src/main/scala/org/apache/spark/deploy/worker/ExecutorRunner.scala
----------------------------------------------------------------------
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 83e24a7..7d5acab 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
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org