Closed Bug 814278 Opened 12 years ago Closed 12 years ago

Intermittent testThumbnails | Exception caught - java.lang.NullPointerException

Categories

(Firefox for Android Graveyard :: Awesomescreen, defect)

19 Branch
ARM
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 20

People

(Reporter: RyanVM, Assigned: gbrown)

References

Details

(Keywords: intermittent-failure)

Attachments

(1 file)

https://tbpl.mozilla.org/php/getParsedLog.php?id=17255402&tree=Mozilla-Aurora

Android no-ionmonkey Tegra 250 mozilla-aurora opt test robocop on 2012-11-21 14:54:54 PST for push 5cc17a8167b0
slave: tegra-357

0 INFO SimpleTest START
1 INFO TEST-START | testThumbnails
2 INFO TEST-PASS | testThumbnails | Awesomebar URL typed properly - http://mochi.test:8888/tests/robocop/robocop_404.sjs?type=changeColor should equal http://mochi.test:8888/tests/robocop/robocop_404.sjs?type=changeColor
3 INFO TEST-PASS | testThumbnails | Awesomebar URL typed properly - http://mochi.test:8888/tests/robocop/robocop_404.sjs?type=do404 should equal http://mochi.test:8888/tests/robocop/robocop_404.sjs?type=do404
4 INFO TEST-PASS | testThumbnails | Awesomebar URL typed properly - about:home should equal about:home
5 INFO TEST-PASS | testThumbnails | Top site thumbnail updated for HTTP 200 - -16711936 should equal -16711936
Exception caught during test!
java.lang.NullPointerException
	at org.mozilla.fennec_aurora.tests.testThumbnails.getTopSiteThumbnailColor(testThumbnails.java:114)
	at org.mozilla.fennec_aurora.tests.testThumbnails.access$000(testThumbnails.java:23)
	at org.mozilla.fennec_aurora.tests.testThumbnails$ThumbnailTest.test(testThumbnails.java:105)
	at org.mozilla.fennec_aurora.tests.BaseTest.waitForTest(BaseTest.java:256)
	at org.mozilla.fennec_aurora.tests.testThumbnails.testThumbnails(testThumbnails.java:58)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:521)
	at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:204)
	at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:194)
	at android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:186)
	at org.mozilla.fennec_aurora.tests.BaseTest.runTest(BaseTest.java:120)
	at junit.framework.TestCase.runBare(TestCase.java:127)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:118)
	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
	at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:520)
	at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1447)
6 INFO TEST-UNEXPECTED-FAIL | testThumbnails | Exception caught - java.lang.NullPointerException
7 INFO TEST-END | testThumbnails | finished in 51673ms
8 INFO TEST-START | Shutdown
9 INFO Passed: 4
10 INFO Failed: 1
11 INFO Todo: 0
12 INFO SimpleTest FINISHED
Version: Trunk → Firefox 19
Assignee: nobody → gbrown
The NPE in both of the logs seems to occur at https://hg.mozilla.org/releases/mozilla-aurora/annotate/fa18bde3e25a/mobile/android/base/tests/testThumbnails.java.in#l114:

 TextView titleView = (TextView) child.findViewById(mTitleId);

suggesting child is null. Is this telling us that the view group is being updated while the test is examining it? 

I am not sure how to sort that out, and mildly encouraged by the fact that this has only happened on aurora and only a couple of times. Instead, here's a patch to guard against the actual exception, trading the exception for a logged warning message and perhaps a failed test later on. While I was at it, I figured findViewById could also conceivably return null, so I've guarded against that. 

Unfortunately, all of these checks have turned a previously tidy function into a tree of conditions...but I think it will help us to understand future failures more easily.
Attachment #689022 - Flags: review?(bnicholson)
I imagine this is happening because of bug 798683. We call getChildCount(), then iterate through the views at each index, but getChildAt() only works for visible views. We should probably do something similar to getCustomSearchView() in https://bug811445.bugzilla.mozilla.org/attachment.cgi?id=686431 - that is, if the view isn't visible, we scroll down.
Depends on: 798683
Blocks: 798683
No longer depends on: 798683
Comment on attachment 689022 [details] [diff] [review]
guard against NPE in getTopSiteThumbnailColor

If it only happens on Aurora, this has hopefully been fixed already. Even though it's likely from trying to get a view that's not visible (bug 798683), it'd be nice to understand why it's not visible in the first place. Adding dumps sounds like a good idea to help figure out the cause.

Should this be landed on Aurora only?
Attachment #689022 - Flags: review?(bnicholson) → review+
Sorry, I got confused about getChildCount(). I don't think getChildCount() returning only visible views is relevant to ViewGroups; unlike a ListView, the ViewGroup is inflated with all child views at once.
No longer blocks: 798683
(In reply to Brian Nicholson (:bnicholson) from comment #4)
> Should this be landed on Aurora only?

It looks like this happens very infrequently anywhere, so it might still be a problem: I'll land normally, then uplift.
https://hg.mozilla.org/mozilla-central/rev/d279fe30ab34
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 20
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: