Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-29152][CORE] Executor Plugin shutdown when dynamic allocation is enabled #26315

Closed
wants to merge 7 commits into from

Conversation

iRakson
Copy link
Contributor

@iRakson iRakson commented Oct 30, 2019

What changes were proposed in this pull request?

Added a shutdown hook which will ensure that shutdown method of executor plugin is getting called.

Why are the changes needed?

When dynamic allocation is enabled and executors get killed after idle time out, shutdown method of executor plugin is not getting called.

Does this PR introduce any user-facing change?

No

How was this patch tested?

Manual Testing

@iRakson
Copy link
Contributor Author

iRakson commented Oct 30, 2019

cc @srowen @dongjoon-hyun

@iRakson iRakson requested a review from srowen November 7, 2019 11:58
@srowen
Copy link
Member

srowen commented Nov 7, 2019

All the previous comments are still outstanding.

@iRakson
Copy link
Contributor Author

iRakson commented Nov 8, 2019

All the previous comments are still outstanding.

plugin Shutdown method has been removed. executorShutdown is needed because in case of graceful shutdown of plugin , shutdown method will be called twice without this variable.

@iRakson iRakson requested a review from vanzin November 8, 2019 11:05
@dongjoon-hyun dongjoon-hyun changed the title [SPARK-29152] Executor Plugin shutdown when dynamic allocation is ena… [SPARK-29152][CORE] Executor Plugin shutdown when dynamic allocation is ena… Nov 10, 2019
Copy link
Member

@srowen srowen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks OK pending tests

@SparkQA
Copy link

SparkQA commented Nov 11, 2019

Test build #4919 has finished for PR 26315 at commit 2afcb71.

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

@iRakson iRakson requested a review from srowen November 11, 2019 17:02
@dongjoon-hyun dongjoon-hyun changed the title [SPARK-29152][CORE] Executor Plugin shutdown when dynamic allocation is ena… [SPARK-29152][CORE] Executor Plugin shutdown when dynamic allocation is enabled Nov 11, 2019
} catch {
case e: Exception =>
logWarning("Plugin " + plugin.getClass().getCanonicalName() + " shutdown failed", e)
if (!executorShutdown) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although this is unlikely to be a problem, this is not thread-safe. You should use an AtomicBoolean. Or make stop() synchronized.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

executorShutdown is volatile; the race is still that it could be set between this line and the next? yeah agree. While we're here, worth fixing with AtomicBoolean and compareAndSet

@iRakson
Copy link
Contributor Author

iRakson commented Nov 12, 2019

I have made the required changes. Please re-test this one.

case e: Exception =>
logWarning("Plugin " + plugin.getClass().getCanonicalName() + " shutdown failed", e)
if (!executorShutdown.get()) {
executorShutdown.compareAndSet(false, true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work to separately check and set the value; it loses the atomic-ness.
Really it just needs to be if (!executorShutdown.getAndSet(true))

@iRakson
Copy link
Contributor Author

iRakson commented Nov 13, 2019

In master, older version of executor plugin was removed today. But i feel this solution is valid for spark 2.4.4.
P.s conflict is also coming because of those changes only.

@srowen
Copy link
Member

srowen commented Nov 13, 2019

OK, we'd need a new PR, yes

@srowen srowen closed this Nov 13, 2019
@srowen
Copy link
Member

srowen commented Nov 14, 2019

@iRakson are you sure it's not applicable in master, given the comments on your other PR?

@iRakson
Copy link
Contributor Author

iRakson commented Nov 14, 2019

i will check in master. If issue is present in master then will update here.

@iRakson
Copy link
Contributor Author

iRakson commented Dec 4, 2019

@srowen @vanzin I checked in master. Executor shutdown problem exists in new interface as well. Can you reopen this PR ??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants