[ 
https://issues.apache.org/jira/browse/HDFS-9590?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15067196#comment-15067196
 ] 

Xiao Chen commented on HDFS-9590:
---------------------------------

This was observed in the following unit test failure of 
TestQJMWithFaults#testRecoverAfterDoubleFailures:
Error Message
{noformat}
Unable to shut down. Check log for details
{noformat}
Stacktrace
{noformat}
java.io.IOException: Unable to shut down. Check log for details
        at 
org.apache.hadoop.hdfs.qjournal.MiniJournalCluster.shutdown(MiniJournalCluster.java:161)
        at 
org.apache.hadoop.hdfs.qjournal.client.TestQJMWithFaults.testRecoverAfterDoubleFailures(TestQJMWithFaults.java:181)
        at 
org.apache.hadoop.hdfs.qjournal.client.TestQJMWithFaults.testRecoverAfterDoubleFailures(TestQJMWithFaults.java:138)
{noformat}
Standard Output is pretty long, but the one that Error Message wants us to 
check is:
{noformat}
2015-12-20 18:51:46,825 WARN  qjournal.MiniJournalCluster 
(MiniJournalCluster.java:shutdown(157)) - Unable to stop journal node 
org.apache.hadoop.hdfs.qjournal.server.JournalNode@fcb345b
java.lang.NullPointerException
        at 
org.apache.hadoop.hdfs.server.common.Storage$StorageDirectory.unlock(Storage.java:747)
        at 
org.apache.hadoop.hdfs.server.common.Storage.unlockAll(Storage.java:1125)
        at 
org.apache.hadoop.hdfs.qjournal.server.JNStorage.close(JNStorage.java:249)
        at 
org.apache.hadoop.hdfs.qjournal.server.Journal.close(Journal.java:227)
        at org.apache.hadoop.io.IOUtils.cleanup(IOUtils.java:244)
        at 
org.apache.hadoop.hdfs.qjournal.server.JournalNode.stop(JournalNode.java:207)
        at 
org.apache.hadoop.hdfs.qjournal.server.JournalNode.stopAndJoin(JournalNode.java:232)
        at 
org.apache.hadoop.hdfs.qjournal.MiniJournalCluster.shutdown(MiniJournalCluster.java:154)
        at 
org.apache.hadoop.hdfs.qjournal.client.TestQJMWithFaults.testRecoverAfterDoubleFailures(TestQJMWithFaults.java:181)
        at 
org.apache.hadoop.hdfs.qjournal.client.TestQJMWithFaults.testRecoverAfterDoubleFailures(TestQJMWithFaults.java:138)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
        at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
        at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
        at 
org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:283)
        at 
org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:173)
        at 
org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
        at 
org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:128)
        at 
org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203)
        at 
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155)
        at 
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
2015-12-20 18:51:46,825 INFO  ipc.Server (Server.java:stop(2485)) - Stopping 
server on 36031
{noformat}

Where Storage.java:747 in the version is {{this.lock.release();}}

> NPE in Storage#unlock
> ---------------------
>
>                 Key: HDFS-9590
>                 URL: https://issues.apache.org/jira/browse/HDFS-9590
>             Project: Hadoop HDFS
>          Issue Type: Bug
>            Reporter: Xiao Chen
>            Assignee: Xiao Chen
>
> The code looks to be possible to have race conditions in multiple-threaded 
> runs.
> {code}
>     public void unlock() throws IOException {
>       if (this.lock == null)
>         return;
>       this.lock.release();
>       lock.channel().close();
>       lock = null;
>     }
> {code}
> This is called in a handful of places, and I don't see any protection. Shall 
> we add some synchronization mechanism? Not sure if I missed any design 
> assumptions here.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to