Skip to content

[SPARK-14736][core] Deadlock in registering applications while the Master is in the RECOVERING mode - #12506

Closed
nirandaperera wants to merge 1 commit into
apache:masterfrom
nirandaperera:SPARK-14736
Closed

[SPARK-14736][core] Deadlock in registering applications while the Master is in the RECOVERING mode#12506
nirandaperera wants to merge 1 commit into
apache:masterfrom
nirandaperera:SPARK-14736

Conversation

@nirandaperera

@nirandapereranirandaperera commented Apr 19, 2016

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

this PR fixes the issue SPARK-14736 Deadlock in registering applications while the Master is in the RECOVERING mode.
Proposed solution is to keep the registering apps in a separate list when the Master is in the RECOVERING mode and once the recovery is complete, these apps will be registered back. Pls refer the JIRA for more information

How was this patch tested?

I have tested the patch manually

@mridulm

Copy link
Copy Markdown
Contributor

You will need to make this thread safe - the applications are added/re-registered from separate threads, right ?

@HyukjinKwon

HyukjinKwon commented Apr 20, 2016

Copy link
Copy Markdown
Member

Maybe we should correct the title just like the others (this is described in https://cwiki.apache.org/confluence/display/SPARK/Contributing+to+Spark). Also, the title looks truncated.

@nirandapereranirandaperera changed the title fixing SPARK-14736 Deadlock in registering applications while the Mas…[SPARK-14736][core] Deadlock in registering applications while the Master is in the RECOVERING modeApr 20, 2016
@nirandaperera

Copy link
Copy Markdown
ContributorAuthor

@mridulm do you mean to say, the method private def registerApplication(app: ApplicationInfo): Unit = { needs to synchronized?

@mridulm

Copy link
Copy Markdown
Contributor

No.
Updates to waitingAppsWhileRecovering happens from different threads right ? Hence you will need to protect it.

@nirandaperera

nirandaperera commented Apr 21, 2016

Copy link
Copy Markdown
ContributorAuthor

@mridulm You are correct. But if we check the register application method,

 private def registerApplication(app: ApplicationInfo): Unit = {
val appAddress = app.driver.address
if (addressToApp.contains(appAddress)) {
logInfo("Attempted to re-register application at same address: " + appAddress)
return
}
applicationMetricsSystem.registerSource(app.appSource)
apps += app
idToApp(app.id) = app
endpointToApp(app.driver) = app
addressToApp(appAddress) = app
waitingApps += app
}

there are similar array buffers which are getting updated without being synchronized. That is why I omitted making the waitingAppsWhileRecovering synchronized.
am I doing anything wrong there?

@mridulm

Copy link
Copy Markdown
Contributor

No, you are right - this is called only from the event loop - which should ensure thread safety.
I misread where the re-registeration was happening as outside of the event loop.
Please ignore my comment.

@nirandaperera

Copy link
Copy Markdown
ContributorAuthor

Great! can we get this PR merged then? Is there anything else I should do in order to get this merged?

@BryanCutler

Copy link
Copy Markdown
Member

Hi @nirandaperera , I'm not too sure about the Master recovery process so I can't really comment on your code, but it would make a much stronger case for this PR if you could include a test that fails without this change.

@nirandaperera

Copy link
Copy Markdown
ContributorAuthor

@BryanCutler I was looking for some unit tests which could simulate this scenario in the Master.scala class, but I couldn't find any. But i think I can reproduce this in an integration test environment. can you point me to the spark integration tests?

@andrewor14

Copy link
Copy Markdown
Contributor

ok to test

@SparkQA

Copy link
Copy Markdown

Test build #58162 has finished for PR 12506 at commit 17e7949.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@rxin

rxin commented May 27, 2016

Copy link
Copy Markdown
Contributor

@andrewor14 did you review this?

@srowen

Copy link
Copy Markdown
Member

Looks reasonable to me but I don't know this code very well. Also @kayousterhout maybe or @squito

@kayousterhout

Copy link
Copy Markdown
Contributor

@aarondav might be the right person to look at this -- looks like he wrote most of the original code around the "RECOVERING" state way back in 2013.

@squito

Copy link
Copy Markdown
Contributor

unfortunately I'm not very knowledgeable here either. I agree that this change looks reasonable, but also wish there was a test case for it. I don't think there is any good integration test framework, and it seems there aren't any tests for recovery state now, so you'd have to build that out yourself. One possibility -- "local-cluster" mode is closely related to a standalone cluster -- maybe that could be used to create a test?

@nirandaperera

Copy link
Copy Markdown
ContributorAuthor

@squito hey. Thanks for the heads up. let me check on that and try to come up with a test

@jiangxb1987

Copy link
Copy Markdown
Contributor

Are you still working on this? @nirandaperera

@HyukjinKwonHyukjinKwon mentioned this pull request Jun 7, 2017
@asfgitasfgit closed this in b771fedJun 8, 2017
zifeif2 pushed a commit to zifeif2/spark that referenced this pull request Nov 22, 2025
# What changes were proposed in this pull request?
This PR proposes to close stale PRs, mostly the same instances with apache#18017Closesapache#11459Closesapache#13833Closesapache#13720Closesapache#12506Closesapache#12456Closesapache#12252Closesapache#17689Closesapache#17791Closesapache#18163Closesapache#17640Closesapache#17926Closesapache#18163Closesapache#12506Closesapache#18044Closesapache#14036Closesapache#15831Closesapache#14461Closesapache#17638Closesapache#18222
Added:
Closesapache#18045Closesapache#18061Closesapache#18010Closesapache#18041Closesapache#18124Closesapache#18130Closesapache#12217
Added:
Closesapache#16291Closesapache#17480Closesapache#14995
Added:
Closesapache#12835Closesapache#17141
## How was this patch tested?
N/A
Author: hyukjinkwon <gurwls223@gmail.com>
Closesapache#18223 from HyukjinKwon/close-stale-prs.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

11 participants

@nirandaperera@mridulm@HyukjinKwon@BryanCutler@andrewor14@SparkQA@rxin@srowen@kayousterhout@squito@jiangxb1987