Repository: spark
Updated Branches:
  refs/heads/master 66a03e5fe -> ca76423e2


[Hot Fix #42] Do not stop SparkUI if bind() is not called

This is a bug fix for #42 (79d07d66040f206708e14de393ab0b80020ed96a).

In Master, we do not bind() each SparkUI because we do not want to start a 
server for each finished application. However, when we remove the associated 
application, we call stop() on the SparkUI, which throws an assertion failure.

This fix ensures we don't call stop() on a SparkUI that was never bind()'ed.

Author: Andrew Or <andrewo...@gmail.com>

Closes #188 from andrewor14/ui-fix and squashes the following commits:

94a925f [Andrew Or] Do not stop SparkUI if bind() is not called


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/ca76423e
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/ca76423e
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/ca76423e

Branch: refs/heads/master
Commit: ca76423e23f5f626c56041cecbc38a93ae1e0298
Parents: 66a03e5
Author: Andrew Or <andrewo...@gmail.com>
Authored: Thu Mar 20 14:13:16 2014 -0700
Committer: Patrick Wendell <pwend...@gmail.com>
Committed: Thu Mar 20 14:13:16 2014 -0700

----------------------------------------------------------------------
 .../scala/org/apache/spark/deploy/master/Master.scala    | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/ca76423e/core/src/main/scala/org/apache/spark/deploy/master/Master.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/org/apache/spark/deploy/master/Master.scala 
b/core/src/main/scala/org/apache/spark/deploy/master/Master.scala
index 1fd2114..9ed49e0 100644
--- a/core/src/main/scala/org/apache/spark/deploy/master/Master.scala
+++ b/core/src/main/scala/org/apache/spark/deploy/master/Master.scala
@@ -149,7 +149,6 @@ private[spark] class Master(
 
   override def postStop() {
     webUi.stop()
-    appIdToUI.values.foreach(_.stop())
     masterMetricsSystem.stop()
     applicationMetricsSystem.stop()
     persistenceEngine.close()
@@ -622,10 +621,7 @@ private[spark] class Master(
       if (completedApps.size >= RETAINED_APPLICATIONS) {
         val toRemove = math.max(RETAINED_APPLICATIONS / 10, 1)
         completedApps.take(toRemove).foreach( a => {
-          appIdToUI.remove(a.id).foreach { ui =>
-            ui.stop()
-            webUi.detachUI(ui)
-          }
+          appIdToUI.remove(a.id).foreach { ui => webUi.detachUI(ui) }
           applicationMetricsSystem.removeSource(a.appSource)
         })
         completedApps.trimStart(toRemove)
@@ -681,10 +677,7 @@ private[spark] class Master(
     // Do not call ui.bind() to avoid creating a new server for each 
application
     ui.start()
     val success = replayerBus.replay(eventLogDir)
-    if (!success) {
-      ui.stop()
-      None
-    } else Some(ui)
+    if (success) Some(ui) else None
   }
 
   /** Generate a new app ID given a app's submission date */

Reply via email to