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
Conversation
All the previous comments are still outstanding. |
88fe38b
to
153e879
Compare
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. |
…bled: Made executorShutdown variable volatile and fixed style errors
…bled: Review Comments fix.
…bled: Move check variable to the start of method.
90efbf8
to
2afcb71
Compare
There was a problem hiding this 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
Test build #4919 has finished for PR 26315 at commit
|
} catch { | ||
case e: Exception => | ||
logWarning("Plugin " + plugin.getClass().getCanonicalName() + " shutdown failed", e) | ||
if (!executorShutdown) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
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) |
There was a problem hiding this comment.
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))
In master, older version of executor plugin was removed today. But i feel this solution is valid for spark 2.4.4. |
OK, we'd need a new PR, yes |
@iRakson are you sure it's not applicable in master, given the comments on your other PR? |
i will check in master. If issue is present in master then will update here. |
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