[
https://issues.apache.org/jira/browse/MESOS-3264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14711976#comment-14711976
]
Greg Mann commented on MESOS-3264:
----------------------------------
[[email protected]] thanks for working on this! Yea a solution like that
should work (though the {{close()}} method needs to be added to the
SchedulerDriver rather than the ExecutorDriver, since the {{driver}} in the
test framework is a SchedulerDriver).
I tested a solution similar to this and it worked for me; I was hesitant to use
it because I'm a beginner with Java and there's some conventional wisdom out
there saying "running finalizers explicitly is a Bad Thing", but after digging
into a bit more I can't find a really good reason not to, especially since
you're testing {{if (closed) ...}} to make sure we don't attempt to close it
twice. If you think this is an acceptable solution, I'd say let's go for it.
Perhaps an additional person with some Java expertise would like to weigh in?
[~bernd-mesos]?
> JVM can exit prematurely following framework teardown
> -----------------------------------------------------
>
> Key: MESOS-3264
> URL: https://issues.apache.org/jira/browse/MESOS-3264
> Project: Mesos
> Issue Type: Bug
> Components: java api
> Affects Versions: 0.23.0, 0.24.0
> Reporter: Greg Mann
> Assignee: haosdent
> Priority: Minor
> Labels: java, tech-debt
>
> In Java frameworks, it is possible for the JVM to begin exiting the program -
> via {{System.exit()}}, for example - while teardown of native objects such as
> the SchedulerDriver and associated Executors is still in progress.
> {{SchedulerDriver::stop()}} will return after it has sent messages to other
> actors to begin their teardown, meanwhile the JVM is free to terminate the
> program and thus begin executing native object destructors while those
> objects are still in use, potentially leading to a segfault.
> This has manifested itself in flaky tests from the ExamplesTest suite (see
> MESOS-830 and MESOS-1013), as mutexes from glog are destroyed while the
> framework is still shutting down and attempting to log.
> Ideally, a mechanism would exist to block the Java code until a confirmation
> that framework teardown is complete has been received.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)