Closed Bug 838636 Opened 7 years ago Closed 7 years ago

java.lang.NullPointerException at org.mozilla.fennec.tests.BaseTest.setUp(BaseTest.java:82): intermittent robocop failure

Categories

(Firefox for Android :: General, defect)

x86
Android
defect
Not set

Tracking

()

RESOLVED FIXED
Firefox 21

People

(Reporter: gbrown, Assigned: gbrown)

References

Details

Attachments

(1 file, 1 obsolete file)

Bug 686245, comment 1298 is a Java exception on m-i: 

01-09 10:25:59.103 I/TestRunner( 2555): java.lang.NullPointerException
01-09 10:25:59.103 I/TestRunner( 2555): 	at org.mozilla.fennec.tests.BaseTest.setUp(BaseTest.java:82)
01-09 10:25:59.103 I/TestRunner( 2555): 	at org.mozilla.fennec.tests.ContentProviderTest.setUp(ContentProviderTest.java:220)
01-09 10:25:59.103 I/TestRunner( 2555): 	at org.mozilla.fennec.tests.testBrowserProviderPerf.setUp(testBrowserProviderPerf.java:256)
01-09 10:25:59.103 I/TestRunner( 2555): 	at junit.framework.TestCase.runBare(TestCase.java:125)
01-09 10:25:59.103 I/TestRunner( 2555): 	at junit.framework.TestResult$1.protect(TestResult.java:106)
01-09 10:25:59.103 I/TestRunner( 2555): 	at junit.framework.TestResult.runProtected(TestResult.java:124)
01-09 10:25:59.103 I/TestRunner( 2555): 	at junit.framework.TestResult.run(TestResult.java:109)
01-09 10:25:59.103 I/TestRunner( 2555): 	at junit.framework.TestCase.run(TestCase.java:118)
01-09 10:25:59.103 I/TestRunner( 2555): 	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
01-09 10:25:59.103 I/TestRunner( 2555): 	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
01-09 10:25:59.103 I/TestRunner( 2555): 	at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:520)
01-09 10:25:59.103 I/TestRunner( 2555): 	at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1447)


:blassey commented:

> so, if I read that corectly, we have a null pointer exception on this line:
> String rootPath = FennecInstrumentationTestRunner.getArguments().getString("deviceroot");
>
> presumably that means that getArguments() is returning null. Let's try catching that and see what we get
Blocks: 686245
I am not clear on how this condition came about, but I note that FennecInstrumentationTestRunner.onCreate and getArguments are called on different threads at about the same time: maybe a race is possible. This patch adds some logging in case we continue to experience problems, and also adds some check-and-retry logic in case there is a race.
Attachment #712002 - Flags: review?(jmaher)
Comment on attachment 712002 [details] [diff] [review]
guard against null arguments in BaseTest.setUp

When I added this code I didn't realize the instrumentation test runner spawned a new thread to run the tests - I should have read the docs more carefully. A simpler fix here is to just move the "sArguments = arguments" assignment one line up, before the call to super.onCreate. The super.onCreate is the thing that spawns the thread, so if sArguments is set before that the race should be eliminated.
Attachment #712002 - Flags: review?(jmaher) → review-
I see - thanks. I am still adding logging, as a precaution.
Attachment #712002 - Attachment is obsolete: true
Attachment #712492 - Flags: review?(bugmail.mozilla)
Comment on attachment 712492 [details] [diff] [review]
guard against null arguments in BaseTest.setUp

Review of attachment 712492 [details] [diff] [review]:
-----------------------------------------------------------------

LGTM
Attachment #712492 - Flags: review?(bugmail.mozilla) → review+
https://hg.mozilla.org/mozilla-central/rev/99e8b116dd09
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 21
You need to log in before you can comment on or make changes to this bug.