hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wei-Chiu Chuang (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-9591) FSImage.loadEdits threw NullPointerException
Date Fri, 19 Feb 2016 14:09:18 GMT

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

Wei-Chiu Chuang commented on HDFS-9591:
---------------------------------------

It looks to me an issue with Mockito, and not with the code itself.
In this test, the edit logs are replaced by a spied Mockito object. I can occasionally see
Mockito errors such as 

{quote}
FAILED:  org.apache.hadoop.hdfs.server.namenode.ha.TestFailureToReadEdits.testCheckpointStartingMidEditsFile[1]

Error Message:

Unfinished stubbing detected here:
-> at org.apache.hadoop.hdfs.server.namenode.ha.TestFailureToReadEdits.causeFailureOnEditLogRead(TestFailureToReadEdits.java:306)

E.g. thenReturn() may be missing.
Examples of correct stubbing:
   when(mock.isOk()).thenReturn(true);
   when(mock.isOk()).thenThrow(exception);
   doThrow(exception).when(mock).someVoidMethod();
Hints:
1. missing thenReturn()
2. although stubbed methods may return mocks, you cannot inline mock creation (mock()) call
inside a thenReturn method (see issue 53)


Stack Trace:
org.mockito.exceptions.misusing.UnfinishedStubbingException: 
Unfinished stubbing detected here:
-> at org.apache.hadoop.hdfs.server.namenode.ha.TestFailureToReadEdits.causeFailureOnEditLogRead(TestFailureToReadEdits.java:306)

E.g. thenReturn() may be missing.
Examples of correct stubbing:
   when(mock.isOk()).thenReturn(true);
   when(mock.isOk()).thenThrow(exception);
   doThrow(exception).when(mock).someVoidMethod();
Hints:
1. missing thenReturn()
2. although stubbed methods may return mocks, you cannot inline mock creation (mock()) call
inside a thenReturn method (see issue 53)

	at org.apache.hadoop.hdfs.server.namenode.ha.TestFailureToReadEdits.causeFailureOnEditLogRead(TestFailureToReadEdits.java:306)
	at org.apache.hadoop.hdfs.server.namenode.ha.TestFailureToReadEdits.testCheckpointStartingMidEditsFile(TestFailureToReadEdits.java:227)


{quote}

I think it is either a Mockito bug, or an improper use of Mockito library. As a result, I'm
going to lower the priority to minor.

> FSImage.loadEdits threw NullPointerException
> --------------------------------------------
>
>                 Key: HDFS-9591
>                 URL: https://issues.apache.org/jira/browse/HDFS-9591
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: fs, ha, namenode
>    Affects Versions: 3.0.0
>         Environment: Jenkins
>            Reporter: Wei-Chiu Chuang
>            Assignee: Wei-Chiu Chuang
>
> https://builds.apache.org/job/PreCommit-HDFS-Build/13963/testReport/org.apache.hadoop.hdfs.server.namenode.ha/TestFailureToReadEdits/testCheckpointStartingMidEditsFile_0_/
> {noformat}
> Error Message
> Expected non-empty /testptch/hadoop/hadoop-hdfs-project/hadoop-hdfs/target/test/data/3/dfs/name-0-3/current/fsimage_0000000000000000005
> Stacktrace
> java.lang.AssertionError: Expected non-empty /testptch/hadoop/hadoop-hdfs-project/hadoop-hdfs/target/test/data/3/dfs/name-0-3/current/fsimage_0000000000000000005
> 	at org.junit.Assert.fail(Assert.java:88)
> 	at org.junit.Assert.assertTrue(Assert.java:41)
> 	at org.apache.hadoop.hdfs.server.namenode.FSImageTestUtil.assertNNHasCheckpoints(FSImageTestUtil.java:470)
> 	at org.apache.hadoop.hdfs.server.namenode.ha.HATestUtil.waitForCheckpoint(HATestUtil.java:235)
> 	at org.apache.hadoop.hdfs.server.namenode.ha.TestFailureToReadEdits.testCheckpointStartingMidEditsFile(TestFailureToReadEdits.java:240)
> {noformat}
> {noformat}
> Exception in thread "Edit log tailer" org.apache.hadoop.util.ExitUtil$ExitException:
java.lang.NullPointerException
> 	at com.google.common.base.Joiner.join(Joiner.java:226)
> 	at org.apache.hadoop.hdfs.server.namenode.FSImage.loadEdits(FSImage.java:818)
> 	at org.apache.hadoop.hdfs.server.namenode.FSImage.loadEdits(FSImage.java:812)
> 	at org.apache.hadoop.hdfs.server.namenode.ha.EditLogTailer.doTailEdits(EditLogTailer.java:257)
> 	at org.apache.hadoop.hdfs.server.namenode.ha.EditLogTailer$EditLogTailerThread.doWork(EditLogTailer.java:371)
> 	at org.apache.hadoop.hdfs.server.namenode.ha.EditLogTailer$EditLogTailerThread.access$400(EditLogTailer.java:324)
> 	at org.apache.hadoop.hdfs.server.namenode.ha.EditLogTailer$EditLogTailerThread$1.run(EditLogTailer.java:341)
> 	at org.apache.hadoop.security.SecurityUtil.doAsLoginUserOrFatal(SecurityUtil.java:444)
> 	at org.apache.hadoop.hdfs.server.namenode.ha.EditLogTailer$EditLogTailerThread.run(EditLogTailer.java:337)
> 	at org.apache.hadoop.util.ExitUtil.terminate(ExitUtil.java:126)
> 	at org.apache.hadoop.util.ExitUtil.terminate(ExitUtil.java:170)
> 	at org.apache.hadoop.hdfs.server.namenode.ha.EditLogTailer$EditLogTailerThread.doWork(EditLogTailer.java:385)
> 	at org.apache.hadoop.hdfs.server.namenode.ha.EditLogTailer$EditLogTailerThread.access$400(EditLogTailer.java:324)
> 	at org.apache.hadoop.hdfs.server.namenode.ha.EditLogTailer$EditLogTailerThread$1.run(EditLogTailer.java:341)
> 	at org.apache.hadoop.security.SecurityUtil.doAsLoginUserOrFatal(SecurityUtil.java:444)
> 	at org.apache.hadoop.hdfs.server.namenode.ha.EditLogTailer$EditLogTailerThread.run(EditLogTailer.java:337)
> {noformat}



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

Mime
View raw message