You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by "Josh Elser (JIRA)" <ji...@apache.org> on 2014/08/10 06:02:11 UTC
[jira] [Commented] (ACCUMULO-3055) calling MiniAccumuloCluster.stop
multiple times fails with NPE
[ https://issues.apache.org/jira/browse/ACCUMULO-3055?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14091992#comment-14091992 ]
Josh Elser commented on ACCUMULO-3055:
--------------------------------------
bq. Since start() doesn't allow multiple starts, we probably shouldn't allow multiple stops
While I agree with you, this would obviously introduce changes in how MAC.stop works. We can/should change the semantics of the method in master, and not in a minor release to avoid trying to break users. Continuing to allow multiple stop()'s wont' hurt anything.
> calling MiniAccumuloCluster.stop multiple times fails with NPE
> --------------------------------------------------------------
>
> Key: ACCUMULO-3055
> URL: https://issues.apache.org/jira/browse/ACCUMULO-3055
> Project: Accumulo
> Issue Type: Bug
> Components: mini, test
> Reporter: Sean Busbey
> Assignee: Josh Elser
> Priority: Critical
> Fix For: 1.5.2, 1.6.1, 1.7.0
>
>
> On the mailing list [~ctubbsii] mentioned seeing some NPEs in the stderr for {{mvn verify}}.
> I see one here when running mvn verify with either hadoop profile:
> {quote}
> Exception in thread "Thread-0" java.lang.NullPointerException
> at org.apache.accumulo.minicluster.MiniAccumuloCluster.stopProcessWithTimeout(MiniAccumuloCluster.java:449)
> at org.apache.accumulo.minicluster.MiniAccumuloCluster.stop(MiniAccumuloCluster.java:376)
> at org.apache.accumulo.minicluster.MiniAccumuloCluster$1.run(MiniAccumuloCluster.java:318)
> {quote}
> The relevant piece of code (in 1.5.2-SNAP) is the {{executor.execute}} below
> {code}
> private int stopProcessWithTimeout(final Process proc, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
> FutureTask<Integer> future = new FutureTask<Integer>(new Callable<Integer>() {
> @Override
> public Integer call() throws InterruptedException {
> proc.destroy();
> return proc.waitFor();
> }
> });
> executor.execute(future);
> return future.get(timeout, unit);
> }
> {code}
> Reading through the code for stop, it nulls out executor when it's done. So the easy way to get an NPE is calling stop() multiple times on a MAC instance. Since we have a shutdown hook that calls stop, that means that a single user invocation of stop should result in a NPE later.
> Since start() doesn't allow multiple starts, we probably shouldn't allow multiple stops. That would mean adding logic to the shutdown hook to check if we're already stopped or making a private unguarded version of stop that allows multiple calls and using that from the hook.
> criteria for closing this issue:
> * MAC should document wether calling stop() multiple times is allowed
> * fix MAC.stop to either guard against multiple calls or handle them gracefully
> * find out why this only gets an NPE in one place. Do we rely on the shutdown hook everywhere?
--
This message was sent by Atlassian JIRA
(v6.2#6252)