New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 637448 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
OOO until Feb 4th
Closed: Sep 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 1
Type: Bug-Regression

Blocked on:
issue 649224



Sign in to add a comment

ChromePublic Instrumentation test flakiness (ChromeSigninController at startup)

Reported by mcda...@amazon.com, Aug 12 2016

Issue description

Steps to reproduce the problem:
1. Run ChromePublic instrumentation tests

What is the expected behavior?
Tests succeed on first attempt

What went wrong?
~4 failures per run (masked by retries)
See https://build.chromium.org/p/chromium.linux/builders/Android%20Tests%20%28dbg%29/builds/35709/steps/chrome_public_test_apk/logs/stdio for examples

I  704.738s run_tests_on_device(0cb844c5032fdbdb)  detected failure in org.chromium.chrome.browser.preferences.website.SiteSettingsPreferencesTest#testPopupsNotBlocked. raw output:
I  704.738s run_tests_on_device(0cb844c5032fdbdb)    INSTRUMENTATION_RESULT: stream=
I  704.738s run_tests_on_device(0cb844c5032fdbdb)    Test results for ChromeInstrumentationTestRunner=Test run aborted due to unexpected exception: null
I  704.738s run_tests_on_device(0cb844c5032fdbdb)    java.lang.ExceptionInInitializerError
I  704.739s run_tests_on_device(0cb844c5032fdbdb)    	at org.chromium.base.ContextUtils.getAppSharedPreferences(ContextUtils.java:89)
I  704.739s run_tests_on_device(0cb844c5032fdbdb)    	at org.chromium.components.sync.signin.ChromeSigninController.getSignedInAccountName(ChromeSigninController.java:70)
I  704.739s run_tests_on_device(0cb844c5032fdbdb)    	at org.chromium.components.sync.signin.ChromeSigninController.getSignedInUser(ChromeSigninController.java:49)
I  704.739s run_tests_on_device(0cb844c5032fdbdb)    	at org.chromium.components.sync.signin.ChromeSigninController.<init>(ChromeSigninController.java:30)
I  704.739s run_tests_on_device(0cb844c5032fdbdb)    	at org.chromium.components.sync.signin.ChromeSigninController.get(ChromeSigninController.java:42)
I  704.739s run_tests_on_device(0cb844c5032fdbdb)    	at org.chromium.chrome.test.util.parameters.AddFakeAccountToAppParameter.<init>(AddFakeAccountToAppParameter.java:35)
I  704.739s run_tests_on_device(0cb844c5032fdbdb)    	at org.chromium.chrome.test.ChromeActivityTestCaseBase.createAvailableParameters(ChromeActivityTestCaseBase.java:772)
I  704.739s run_tests_on_device(0cb844c5032fdbdb)    	at org.chromium.base.test.BaseActivityInstrumentationTestCase.setParameterReader(BaseActivityInstrumentationTestCase.java:76)
I  704.739s run_tests_on_device(0cb844c5032fdbdb)    	at org.chromium.base.test.BaseTestResult.runParameterized(BaseTestResult.java:141)
I  704.739s run_tests_on_device(0cb844c5032fdbdb)    	at org.chromium.base.test.BaseTestResult.run(BaseTestResult.java:124)
I  704.739s run_tests_on_device(0cb844c5032fdbdb)    	at junit.framework.TestCase.run(TestCase.java:124)
I  704.739s run_tests_on_device(0cb844c5032fdbdb)    	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
I  704.739s run_tests_on_device(0cb844c5032fdbdb)    	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
I  704.739s run_tests_on_device(0cb844c5032fdbdb)    	at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554)
I  704.739s run_tests_on_device(0cb844c5032fdbdb)    	at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1701)
I  704.739s run_tests_on_device(0cb844c5032fdbdb)    Caused by: java.lang.NullPointerException
I  704.740s run_tests_on_device(0cb844c5032fdbdb)    	at android.preference.PreferenceManager.getDefaultSharedPreferencesName(PreferenceManager.java:374)
I  704.740s run_tests_on_device(0cb844c5032fdbdb)    	at android.preference.PreferenceManager.getDefaultSharedPreferences(PreferenceManager.java:369)
I  704.740s run_tests_on_device(0cb844c5032fdbdb)    	at org.chromium.base.ContextUtils.fetchAppSharedPreferences(ContextUtils.java:78)
I  704.740s run_tests_on_device(0cb844c5032fdbdb)    	at org.chromium.base.ContextUtils.access$000(ContextUtils.java:17)
I  704.740s run_tests_on_device(0cb844c5032fdbdb)    	at org.chromium.base.ContextUtils$Holder.<clinit>(ContextUtils.java:26)
I  704.740s run_tests_on_device(0cb844c5032fdbdb)    	... 15 more
I  704.740s run_tests_on_device(0cb844c5032fdbdb)    
I  704.740s run_tests_on_device(0cb844c5032fdbdb)    INSTRUMENTATION_CODE: -1

Did this work before? N/A 

Chrome version: <Copy from: 'about:version'>  Channel: canary
OS Version: 
Flash Version: Shockwave Flash 11.2 r202
 
Components: Tests
Status: Available (was: Unconfirmed)

Comment 2 by zea@chromium.org, Sep 9 2016

Components: Services>SignIn Services>Sync
Labels: -Pri-2 Pri-1
Adding Sync because this is affecting chrome_sync_shell_tests, and Signin because it appears to be in the signin logic.
Cc: gogerald@chromium.org anthonyvd@chromium.org
+gogerald who knows a lot about Android signin.

Comment 4 by ew...@chromium.org, Sep 9 2016

Cc: ew...@chromium.org
Labels: signin-active-bug
Owner: gogerald@chromium.org
Status: Assigned (was: Available)
Assigning to Ganggui to take a look.

Ganggui, please take a look at why these tests are breaking when you have time.
Project Member

Comment 5 by bugdroid1@chromium.org, Sep 12 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/d7532546c368710e3b5c8b935151d3e60599ca6e

commit d7532546c368710e3b5c8b935151d3e60599ca6e
Author: boliu <boliu@chromium.org>
Date: Mon Sep 12 18:16:09 2016

Mark all chrome sync tests with @RetryOnFailure

Current theory is all chrome sync tests are flaky due to
 crbug.com/637448 . So mark all of them as requiring retry.

BUG= 619055 ,  637448 

Review-Url: https://codereview.chromium.org/2319863004
Cr-Commit-Position: refs/heads/master@{#417974}

[modify] https://crrev.com/d7532546c368710e3b5c8b935151d3e60599ca6e/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/AutofillTest.java
[modify] https://crrev.com/d7532546c368710e3b5c8b935151d3e60599ca6e/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/BookmarksTest.java
[modify] https://crrev.com/d7532546c368710e3b5c8b935151d3e60599ca6e/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/FirstRunTest.java
[modify] https://crrev.com/d7532546c368710e3b5c8b935151d3e60599ca6e/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/GmsCoreSyncListenerTest.java
[modify] https://crrev.com/d7532546c368710e3b5c8b935151d3e60599ca6e/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/OpenTabsTest.java
[modify] https://crrev.com/d7532546c368710e3b5c8b935151d3e60599ca6e/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncCustomizationFragmentTest.java
[modify] https://crrev.com/d7532546c368710e3b5c8b935151d3e60599ca6e/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncTest.java
[modify] https://crrev.com/d7532546c368710e3b5c8b935151d3e60599ca6e/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/TypedUrlsTest.java
[modify] https://crrev.com/d7532546c368710e3b5c8b935151d3e60599ca6e/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/ui/PassphraseTypeDialogFragmentTest.java

Could not open the link, which test becomes flaky, all sync tests? I've tested *testPopupsNotBlocked* from above post log more than 10 times without failure.

Comment 9 by mcda...@amazon.com, Sep 12 2016

Looks like the log links have changed, https://luci-logdog.appspot.com/v/?s=chromium%2Fbb%2Fchromium.linux%2FAndroid_Tests__dbg_%2F35709%2F%2B%2Frecipes%2Fsteps%2Fchrome_public_test_apk%2F0%2Fstdout seems like the correct link now.

I think any test in in the Chrome Public instrumentation suite can fail, it looks like it happens during initialization.

I don't think it's related to chrome_sync_shell_tests

Comment 10 by mcda...@amazon.com, Sep 12 2016

Ah I see, anything that inherits from ChromeActivityTestCaseBase then. So chrome_sync_shell_tests as well.
Comment #9, 10: looks the null pointer exception happens in getSharedPreference, but not sign in. 

I manually tested *testEnterPassphraseWhenSyncIsOff* more than 20 times without failure.
Labels: Sync-Triaged

Comment 13 by kbr@chromium.org, Sep 22 2016

Cc: kbr@chromium.org jbudorick@chromium.org kainino@chromium.org
Labels: -Pri-1 Pri-0
This seems to be causing many flakes of the chrome_public_test_apk step on the linux_android_rel_ng tryserver, causing retries and random failures of unrelated CLs:

https://build.chromium.org/p/tryserver.chromium.android/builders/linux_android_rel_ng?numbuilds=200

Examples:

https://build.chromium.org/p/tryserver.chromium.android/builders/linux_android_rel_ng/builds/145944
https://build.chromium.org/p/tryserver.chromium.android/builders/linux_android_rel_ng/builds/145938
https://build.chromium.org/p/tryserver.chromium.android/builders/linux_android_rel_ng/builds/145928
https://build.chromium.org/p/tryserver.chromium.android/builders/linux_android_rel_ng/builds/145905

Random affected CL:
https://codereview.chromium.org/2354713004/

I'm upgrading this to P0 as it's affecting Chromium's commit queue. A fix or workaround is urgently needed.

Comment 14 by ew...@chromium.org, Sep 22 2016

Ganggui, are you the right owner for this bug?
#13: 3 of the 4 of those -- all of the ones that didn't affect the CL you referenced -- are related to  issue 619055 , not this.

Comment 16 by kbr@chromium.org, Sep 22 2016

#15: sorry, you're right that a couple of those are not related. However, both of these:

https://build.chromium.org/p/tryserver.chromium.android/builders/linux_android_rel_ng/builds/145928
https://build.chromium.org/p/tryserver.chromium.android/builders/linux_android_rel_ng/builds/145905

have the same stack trace that this bug was filed for:

org.chromium.chrome.browser.instantapps.InstantAppsHandlerTest#testInstantAppsDisabled_incognito (run #1):
java.lang.ExceptionInInitializerError
	at org.chromium.base.ContextUtils.getAppSharedPreferences(ContextUtils.java:96)
	at org.chromium.chrome.browser.instantapps.InstantAppsHandlerTest.setUp(InstantAppsHandlerTest.java:40)
	at org.chromium.base.test.BaseTestResult.run(BaseTestResult.java:129)
	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
	at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554)
	at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1701)
Caused by: java.lang.NullPointerException
	at android.preference.PreferenceManager.getDefaultSharedPreferencesName(PreferenceManager.java:374)
	at android.preference.PreferenceManager.getDefaultSharedPreferences(PreferenceManager.java:369)
	at org.chromium.base.ContextUtils.access$000(ContextUtils.java:2085)
	at org.chromium.base.ContextUtils$Holder.<clinit>(ContextUtils.java:26)
	... 12 more

I didn't go through the rest of the chrome_public_apk failures on that trybot to categorize them.

#15: the first frame is the same, but then it diverges. That's for InstantAppsHandlerTest, while this bug is for ChromeSigninController.

Also, an exception in setUp? :(

Comment 18 by kbr@chromium.org, Sep 22 2016

Labels: -Pri-0 Pri-1
Apologies, I didn't look closely enough at the stack trace. I saw the ExceptionInInitializerError in org.chromium.base.ContextUtils.getAppSharedPreferences and thought it was the same thing.

I'll downgrade this back to P1 and file a separate bug.

#18: no worries. They may be similar failures given the top of the stack trace -- seems they all may use a static in ContextUtils before it gets initialized in some scenarios.

Comment 20 by kbr@chromium.org, Sep 22 2016

Blockedon: 649224
Owner: ----
Comment #14: As I replied in comment #11 and #9, #10, #17, this is not like a sign in related issue from stack trace. I am probably not the right owner.

Comment 22 by wnwen@chromium.org, Sep 23 2016

Owner: wnwen@chromium.org
I'll look into this as it's a ContextUtils initialization issue.
Project Member

Comment 23 by bugdroid1@chromium.org, Sep 27 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/640e90121d42acc469a533ae190e311841189827

commit 640e90121d42acc469a533ae190e311841189827
Author: wnwen <wnwen@chromium.org>
Date: Tue Sep 27 17:46:01 2016

Fix ContextUtils test flakiness.

There was a race condition between Android tests calling
Application#onCreate and TestRunner#runTests which caused flakiness
in some of the UrlManagerTest* and other instrumentation tests.

Initialize the application object earlier so that it is always ready
when tests are run.

BUG= 649224 , 637448 

Review-Url: https://codereview.chromium.org/2363323003
Cr-Commit-Position: refs/heads/master@{#421256}

[modify] https://crrev.com/640e90121d42acc469a533ae190e311841189827/chrome/android/java/src/org/chromium/chrome/browser/ChromeApplication.java

Comment 24 by wnwen@chromium.org, Sep 27 2016

Status: Fixed (was: Assigned)

Sign in to add a comment