Skip to content

Conversation

@lzx404243
Copy link
Contributor

@lzx404243 lzx404243 commented Nov 29, 2020

The test org.apache.hadoop.mapreduce.jobhistory.TestJobHistoryEventHandler.testSigTermedFunctionality is not idempotent and fails if run twice in the same JVM, because it pollutes state shared among tests. It may be good to clean this state pollution so that some other tests do not fail in the future due to the shared state polluted by this test.

Details

Running TestJobHistoryEventHandler.testSigTermedFunctionality twice would result in the second run failing due to NullPointerExceptionshown in the following:

java.lang.NullPointerException
	at org.apache.hadoop.mapreduce.jobhistory.JobHistoryEventHandler.serviceStop(JobHistoryEventHandler.java:460)
	at org.apache.hadoop.service.AbstractService.stop(AbstractService.java:221)
	at org.apache.hadoop.mapreduce.jobhistory.TestJobHistoryEventHandler.testSigTermedFunctionality(TestJobHistoryEventHandler.java:933)

The root cause of this is that running TestJobHistoryEventHandler.testSigTermedFunctionality results in some entries to be added to the static JobHistoryEventHandler.fileMap. The entries in the fileMap are not cleaned up when the test is done, resulting in a NullPointerException in the second run as the stale object(added in the first run) in the fileMap is accessed.

The fix is to clear the fileMap at the end of the constructor of JHEventHandlerForSigtermTest. Note that this has already been done in the JHEvenHandlerForTest, which is used by the other tests in the TestJobHistoryEventHandler. The same clean up needs to take place in JHEventHandlerForSigtermTest.

With the proposed fix, the test does not pollute the shared state (and passes when run twice in the same JVM).

Link to JIRA issue: MAPREDUCE-7310

@lzx404243 lzx404243 changed the title MAPREDUCE-7310: Clear the fileMap in JHEventHandlerForSigtermTest MAPREDUCE-7310. Clear the fileMap in JHEventHandlerForSigtermTest Nov 29, 2020
@hadoop-yetus
Copy link

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 26m 43s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 0m 0s test4tests The patch appears to include 1 new or modified test files.
_ trunk Compile Tests _
+1 💚 mvninstall 32m 51s trunk passed
+1 💚 compile 0m 47s trunk passed with JDK Ubuntu-11.0.9.1+1-Ubuntu-0ubuntu1.18.04
+1 💚 compile 0m 35s trunk passed with JDK Private Build-1.8.0_275-8u275-b01-0ubuntu1~18.04-b01
+1 💚 checkstyle 0m 30s trunk passed
+1 💚 mvnsite 0m 38s trunk passed
+1 💚 shadedclient 16m 37s branch has no errors when building and testing our client artifacts.
+1 💚 javadoc 0m 33s trunk passed with JDK Ubuntu-11.0.9.1+1-Ubuntu-0ubuntu1.18.04
+1 💚 javadoc 0m 29s trunk passed with JDK Private Build-1.8.0_275-8u275-b01-0ubuntu1~18.04-b01
+0 🆗 spotbugs 1m 3s Used deprecated FindBugs config; considering switching to SpotBugs.
+1 💚 findbugs 1m 0s trunk passed
_ Patch Compile Tests _
+1 💚 mvninstall 0m 33s the patch passed
+1 💚 compile 0m 29s the patch passed with JDK Ubuntu-11.0.9.1+1-Ubuntu-0ubuntu1.18.04
+1 💚 javac 0m 29s the patch passed
+1 💚 compile 0m 26s the patch passed with JDK Private Build-1.8.0_275-8u275-b01-0ubuntu1~18.04-b01
+1 💚 javac 0m 26s the patch passed
+1 💚 checkstyle 0m 20s the patch passed
+1 💚 mvnsite 0m 29s the patch passed
+1 💚 whitespace 0m 0s The patch has no whitespace issues.
+1 💚 shadedclient 14m 53s patch has no errors when building and testing our client artifacts.
+1 💚 javadoc 0m 26s the patch passed with JDK Ubuntu-11.0.9.1+1-Ubuntu-0ubuntu1.18.04
+1 💚 javadoc 0m 25s the patch passed with JDK Private Build-1.8.0_275-8u275-b01-0ubuntu1~18.04-b01
+1 💚 findbugs 1m 0s the patch passed
_ Other Tests _
+1 💚 unit 8m 18s hadoop-mapreduce-client-app in the patch passed.
+1 💚 asflicense 0m 33s The patch does not generate ASF License warnings.
110m 27s
Subsystem Report/Notes
Docker ClientAPI=1.40 ServerAPI=1.40 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-2499/1/artifact/out/Dockerfile
GITHUB PR #2499
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient findbugs checkstyle
uname Linux 685fd6ebfde4 4.15.0-60-generic #67-Ubuntu SMP Thu Aug 22 16:55:30 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / 68442b4
Default Java Private Build-1.8.0_275-8u275-b01-0ubuntu1~18.04-b01
Multi-JDK versions /usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.9.1+1-Ubuntu-0ubuntu1.18.04 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_275-8u275-b01-0ubuntu1~18.04-b01
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-2499/1/testReport/
Max. process+thread count 731 (vs. ulimit of 5500)
modules C: hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app U: hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-2499/1/console
versions git=2.17.1 maven=3.6.0 findbugs=4.0.6
Powered by Apache Yetus 0.13.0-SNAPSHOT https://yetus.apache.org

This message was automatically generated.

Copy link
Member

@jiwq jiwq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 Thanks @lzx404243 for the contribution.

@lzx404243
Copy link
Contributor Author

@jiwq Thanks for the review! Is there anything I can do on my end for this to be merged?

@jiwq
Copy link
Member

jiwq commented Dec 8, 2020

@aajisaka Can u help to review it?

@aajisaka aajisaka merged commit ca7dd5f into apache:trunk Jan 12, 2021
@aajisaka
Copy link
Member

Merged. Thank you @lzx404243 and @jiwq

aajisaka pushed a commit that referenced this pull request Jan 12, 2021
)

Co-authored-by: Zhengxi Li <[email protected]>
Reviewed-by: Wanqiang Ji <[email protected]>
Signed-off-by: Akira Ajisaka <[email protected]>
(cherry picked from commit ca7dd5f)
aajisaka pushed a commit that referenced this pull request Jan 12, 2021
)

Co-authored-by: Zhengxi Li <[email protected]>
Reviewed-by: Wanqiang Ji <[email protected]>
Signed-off-by: Akira Ajisaka <[email protected]>
(cherry picked from commit ca7dd5f)
aajisaka pushed a commit that referenced this pull request Jan 12, 2021
)

Co-authored-by: Zhengxi Li <[email protected]>
Reviewed-by: Wanqiang Ji <[email protected]>
Signed-off-by: Akira Ajisaka <[email protected]>
(cherry picked from commit ca7dd5f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants