Github user vinodkc commented on a diff in the pull request:
https://github.com/apache/spark/pull/7364#discussion_r34534208
--- 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 --
I've added duplicate condition to avoid synchronization in case `app`
doesn't exist in `apps`.if that is not required , I'll remove double checking.
Yes, `removeApplication` can be called concurrently with the same `app`
instance from message loop in Master.scala and also from handleAppKillRequest
in MasterPage.scala.
This fix is not for handling concurrent modification of 'app'
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]