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

Issue 605567 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Apr 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 1
Type: Bug

Blocking:
issue 717960



Sign in to add a comment

AndroidSyncSettingsTests fail an assertion on Android GN

Project Member Reported by jbudorick@chromium.org, Apr 21 2016

Issue description

https://uberchromegw.corp.google.com/i/chromium.linux/builders/Android%20GN/builds/33904

from the logcat:

b9ba0:  04-21 15:17:27.319 11858 11872 I TestRunner: started: testSyncSettingsCaching(org.chromium.sync.AndroidSyncSettingsTest)
b9ba0:  04-21 15:17:27.319 11858 11858 W dalvikvm: VFY: unable to resolve instance field 70
b9ba0:  04-21 15:17:27.319 11858 11858 D dalvikvm: VFY: replacing opcode 0x54 at 0x000c
b9ba0:  04-21 15:17:27.329 11858 11858 D dalvikvm: DexOpt: couldn't find field Landroid/content/pm/PackageInfo;.splitNames
b9ba0:  04-21 15:17:27.329 11858 11858 I dalvikvm: DexOpt: unable to optimize instance field ref 0x0046 at 0x11 in Lorg/chromium/base/BuildInfo;.hasLanguageApkSplits
b9ba0:  04-21 15:17:27.329 11858 11858 D dalvikvm: DexOpt: couldn't find field Landroid/content/pm/PackageInfo;.splitNames
b9ba0:  04-21 15:17:27.329 11858 11858 I dalvikvm: DexOpt: unable to optimize instance field ref 0x0046 at 0x16 in Lorg/chromium/base/BuildInfo;.hasLanguageApkSplits
b9ba0:  04-21 15:17:27.329 11858 11858 D AndroidRuntime: Shutting down VM
b9ba0:  04-21 15:17:27.329 11858 11858 W dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x41588ba8)
b9ba0:  04-21 15:17:27.339 11848 11848 D AndroidRuntime: Shutting down VM
b9ba0:  04-21 15:17:27.339 11848 11852 D dalvikvm: GC_CONCURRENT freed 102K, 16% free 567K/672K, paused 0ms+0ms, total 2ms
b9ba0:  04-21 15:17:27.339 11858 11858 E AndroidRuntime: FATAL EXCEPTION: main
b9ba0:  04-21 15:17:27.339 11858 11858 E AndroidRuntime: Process: org.chromium.chrome, PID: 11858
b9ba0:  04-21 15:17:27.339 11858 11858 E AndroidRuntime: java.lang.AssertionError
b9ba0:  04-21 15:17:27.339 11858 11858 E AndroidRuntime:  at org.chromium.sync.signin.AccountManagerHelper.initializeAccountManagerHelper(AccountManagerHelper.java:98)
b9ba0:  04-21 15:17:27.339 11858 11858 E AndroidRuntime:  at org.chromium.chrome.browser.ChromeApplication.onCreate(ChromeApplication.java:225)
b9ba0:  04-21 15:17:27.339 11858 11858 E AndroidRuntime:  at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
b9ba0:  04-21 15:17:27.339 11858 11858 E AndroidRuntime:  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4344)
b9ba0:  04-21 15:17:27.339 11858 11858 E AndroidRuntime:  at android.app.ActivityThread.access$1500(ActivityThread.java:135)
b9ba0:  04-21 15:17:27.339 11858 11858 E AndroidRuntime:  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
b9ba0:  04-21 15:17:27.339 11858 11858 E AndroidRuntime:  at android.os.Handler.dispatchMessage(Handler.java:102)
b9ba0:  04-21 15:17:27.339 11858 11858 E AndroidRuntime:  at android.os.Looper.loop(Looper.java:136)
b9ba0:  04-21 15:17:27.339 11858 11858 E AndroidRuntime:  at android.app.ActivityThread.main(ActivityThread.java:5017)
b9ba0:  04-21 15:17:27.339 11858 11858 E AndroidRuntime:  at java.lang.reflect.Method.invokeNative(Native Method)
b9ba0:  04-21 15:17:27.339 11858 11858 E AndroidRuntime:  at java.lang.reflect.Method.invoke(Method.java:515)
b9ba0:  04-21 15:17:27.339 11858 11858 E AndroidRuntime:  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
b9ba0:  04-21 15:17:27.339 11858 11858 E AndroidRuntime:  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
b9ba0:  04-21 15:17:27.339 11858 11858 E AndroidRuntime:  at dalvik.system.NativeStart.main(Native Method)
b9ba0:  04-21 15:17:27.339   800  1014 W ActivityManager: Error in app org.chromium.chrome running instrumentation ComponentInfo{org.chromium.chrome.tests/org.chromium.chrome.test.ChromeInstrumentationTestRunner}:
b9ba0:  04-21 15:17:27.339   800  1014 W ActivityManager:   java.lang.AssertionError
b9ba0:  04-21 15:17:27.339   800  1014 W ActivityManager:   java.lang.AssertionError
b9ba0:  04-21 15:17:27.569   800  1014 I ActivityManager: Force stopping org.chromium.chrome appid=10079 user=0: finished inst
b9ba0:  04-21 15:17:27.569   800  1014 I ActivityManager: Killing 11858:org.chromium.chrome/u0a79 (adj 0): stop org.chromium.chrome

disabling the test for now.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Apr 21 2016

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

commit 8af013f31bf9c9c8f1c4f07d2481d74a0808001a
Author: jbudorick <jbudorick@chromium.org>
Date: Thu Apr 21 17:04:36 2016

[Android] Disable AndroidSyncSettingsTest.testSyncSettingsCaching.

BUG= 605567 
TBR=maxbogue@chromium.org

Review URL: https://codereview.chromium.org/1906473005

Cr-Commit-Position: refs/heads/master@{#388795}

[modify] https://crrev.com/8af013f31bf9c9c8f1c4f07d2481d74a0808001a/sync/android/javatests/src/org/chromium/sync/AndroidSyncSettingsTest.java

Hey, sorry, I feel like I'm missing something...

a) I can't find those log lines you pasted anywhere in the link you gave. Which  link was that under?
b) I can't see how those log errors could possibly be related to that test, especially not to *specifically* that test, which means you just reduced our test coverage for no reason. Could you please re-enable the test?
a) the log lines are from the logcat: https://storage.cloud.google.com/chromium-android/logcat_dumps/Android%20GN/33904 (beware that it's very unwieldy)
b) it's very possible that it's not specifically that test, that it's something more broadly in AndroidSyncSettingsTest. I'd prefer that we investigate it a bit more before reenabling.
How does one get to that logcat dump from the link you provided in the top? I've been puzzled about this before.

AndroidSyncSettingsTest overrides AccountManagerHelper here: https://code.google.com/p/chromium/codesearch#chromium/src/sync/android/javatests/src/org/chromium/sync/AndroidSyncSettingsTest.java&l=115

This happens as part of its setUp method. Based on where the AssertionError is happening (ChromeApplication.onCreate), it seems like there must be a race condition between the creation of the Application object and setup of the actual InstrumentationTestCase object in the Android testing suite for this to be occurring. That, or for some reason the ChromeApplication object is getting created again without the AMH override being cleared? I thought all of the global state (singletons and such) went away between test cases...

Do you have any insight into what could be done here?
Summary: AndroidSyncSettingsTests fail an assertion on Android GN (was: AndroidSyncSettings#testSyncSettingsCaching flakily fails an assertion on Android GN)
This flake occurred in other AndroidSyncSettingsTests, too: https://build.chromium.org/p/chromium.linux/builders/Android%20GN/builds/33908

I'm disabling the suite pending further investigation. I'll look a bit more into what we could do re AMH.

The logcat is available in the logcat_dump link under "gsutil upload" (see attached)
Screen Shot 2016-04-21 at 11.20.10 AM.png
21.8 KB View Download
Cc: jbudorick@chromium.org miguelg@chromium.org
 Issue 605172  has been merged into this issue.
Project Member

Comment 7 by bugdroid1@chromium.org, Apr 21 2016

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

commit f81a32b2b192213bca4600a92be85cbf2ef5a24d
Author: jbudorick <jbudorick@chromium.org>
Date: Thu Apr 21 22:46:20 2016

[Android] Disable AndroidSyncSettingsTests.

BUG= 605567 
TBR=maxbogue@chromium.org

Review URL: https://codereview.chromium.org/1909223002

Cr-Commit-Position: refs/heads/master@{#388934}

[modify] https://crrev.com/f81a32b2b192213bca4600a92be85cbf2ef5a24d/sync/android/javatests/src/org/chromium/sync/AndroidSyncSettingsTest.java

Cc: -miguelg@chromium.org -jbudorick@chromium.org maxbogue@chromium.org
Owner: jbudorick@chromium.org

Comment 9 by s...@chromium.org, Feb 28 2017

Cc: s...@chromium.org
Components: Services>Sync

Comment 10 by zea@chromium.org, Feb 28 2017

Components: -Tests Tests>Disabled
Labels: -Pri-2 Pri-1
Bumping priority as this is a large suite of tests that have been disabled. jbodorick@, is there any status update? I'd like to re-enable these tests if possible, but it's not clear to me what needs to be done. The error in the original post doesn't seem sync related, and seems more likely to be an infra thing (that maybe has been fixed?).
Owner: pav...@chromium.org
Status: Started (was: Assigned)
After enabling test and running it locally I discovered that the test consistently fails. This happens because as side effect of change http://crrev.com/2778443002 the code that blocks test until AndroidSyncSettings.updateSyncability completes was removed. Upon further examination I noticed that AndroidSyncSettings.updateSyncability is not thread safe, initial part of it is executed under mLock, but the part that processes results of AccountManagerHelper.getGoogleAccounts is executed on separate thread without the lock. I'll need to refactor this code to make it safe and testable.
Original stack reported at the top is related to AccountMAnagerHelper initialization. Related bug it  crbug.com/710901 .
Hi Pavel. I've stumbled on this bug a bit late, sorry for that.

You're correct, https://codereview.chromium.org/2778443002 broke AndroidSyncSettingsTest assumptions on MockAccountManager implementation. Since test was disabled, I haven't realized it until today. I've created CL to fix this: https://codereview.chromium.org/2847663003. Could you please take a look?

 http://crbug.com/710901  is likely unrelated to the first stack (change that caused it was made less than a month ago). This change should resolve some inconsistencies in AccountManagerHelper initialization. You might need to add explicit  overrideAccountManagerHelperForTests/resetAccountManagerHelperForTests to your setUp/tearDown. Feel free to text me if you have any questions.
Cc: bsazonov@chromium.org
It looks like overrideAccountManagerHelperForTests/resetAccountManagerHelperForTests calls are already in place:  
https://cs.chromium.org/chromium/src/components/sync/android/javatests/src/org/chromium/components/sync/AndroidSyncSettingsTest.java?l=116&rcl=7ecf76cd742b892d99ccea28a30277bdb3f678ae.
re #14: 
You are right, initial report indicates that ChromeApplication.onCreate was called where it probably shouldn't have been and AccountManagerHelper.initializeAccountManagerHelper discovered instance of AccountManagerHelper created by test. Your change (http://crrev.com/2836373003) should address this issue. 

Project Member

Comment 18 by bugdroid1@chromium.org, Apr 27 2017

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

commit f38bef32638791c40638f05cb48eb2041f71b7fe
Author: bsazonov <bsazonov@chromium.org>
Date: Thu Apr 27 20:50:45 2017

Add callback to AndroidSyncSettings.updateAccount and fix related test

AndroidSyncSettingsTest depends on implementation details of MockAccountManager
to wait for async method completion. These necessary details were removed
by 4a6245e626500c412e86e74e110542d33408e679. This CL fixes this test by
adding callback to AndroidSyncSettings.updateAccount.

BUG= 605567 

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

[modify] https://crrev.com/f38bef32638791c40638f05cb48eb2041f71b7fe/components/sync/android/java/src/org/chromium/components/sync/AndroidSyncSettings.java
[modify] https://crrev.com/f38bef32638791c40638f05cb48eb2041f71b7fe/components/sync/android/javatests/src/org/chromium/components/sync/AndroidSyncSettingsTest.java

Project Member

Comment 19 by bugdroid1@chromium.org, Apr 28 2017

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

commit 20c0b3059ef47f07a3e09e40f1dcc167da4817d8
Author: pavely <pavely@chromium.org>
Date: Fri Apr 28 19:49:56 2017

[Sync] Enable AndroidSyncSettingsTest

I think original issue was caused by ChromeApplication.onCreate calling
AccountManagerHelper.initializeAccountManagerHelper and discovering instance of
AccountManagerHelper that was set up by test. This issue is addressed by
http://crrev.com/2836373003.

Another issue was that waiting for syncability propagation to ContentResolver
got broken by refactoring http://crrev.com/2778443002. This issue was addressed
by change http://crrev.com/2847663003.

Seems like after these changes test should be passing. I ran it in a loop for
1000 iterations and it passed so I'm enabling the test.

BUG= 605567 
R=pnoland@chromium.org

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

[modify] https://crrev.com/20c0b3059ef47f07a3e09e40f1dcc167da4817d8/components/sync/android/javatests/src/org/chromium/components/sync/AndroidSyncSettingsTest.java

Status: Fixed (was: Started)
Blocking: 717960
Components: Tests>Disabled
Labels: Test-Disabled

Sign in to add a comment