Github user srowen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/7364#discussion_r34446919
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/master/Master.scala 
---
    @@ -727,40 +727,44 @@ private[master] class Master(
     
       def removeApplication(app: ApplicationInfo, state: 
ApplicationState.Value) {
         if (apps.contains(app)) {
    -      logInfo("Removing app " + app.id)
    -      apps -= app
    -      idToApp -= app.id
    -      endpointToApp -= app.driver
    -      addressToApp -= app.driver.address
    -      if (completedApps.size >= RETAINED_APPLICATIONS) {
    -        val toRemove = math.max(RETAINED_APPLICATIONS / 10, 1)
    -        completedApps.take(toRemove).foreach( a => {
    -          appIdToUI.remove(a.id).foreach { ui => webUi.detachSparkUI(ui) }
    -          applicationMetricsSystem.removeSource(a.appSource)
    -        })
    -        completedApps.trimStart(toRemove)
    -      }
    -      completedApps += app // Remember it in our history
    -      waitingApps -= app
    +      synchronized{
    --- End diff --
    
    You shouldn't duplicate the condition. The whole block should be 
synchronized and a single check inside of it. But this wouldn't really avoid a 
thread-safety problem, as `apps` is modified elsewhere.
    
    What are you trying to solve? concurrent modification of `apps`?
    or are you saying `removeApplication` can be called somehow concurrently 
with the same `app` -- are you sure?


---
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