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

Issue 722303 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Oct 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: ----



Sign in to add a comment

BookmarkTest#testSearchBookmarks is failing on tablets.

Project Member Reported by aber...@chromium.org, May 15 2017

Issue description

chrome_public_test_apk.chrome_public_test_apk failing on 2 builders

Builders failed on: 
- Lollipop Tablet Tester: 
  https://build.chromium.org/p/chromium.android/builders/Lollipop%20Tablet%20Tester
- Marshmallow Tablet Tester: 
  https://build.chromium.org/p/chromium.android/builders/Marshmallow%20Tablet%20Tester

Example stack

C 1156.304s Main  [FAIL] org.chromium.chrome.browser.bookmarks.BookmarkTest#testSearchBookmarks:
C 1156.304s Main  java.lang.RuntimeException: Unable to destroy activity {org.chromium.chrome/org.chromium.chrome.browser.ChromeTabbedActivity}: java.util.EmptyStackException
C 1156.304s Main  	at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3706)
C 1156.304s Main  	at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3724)
C 1156.304s Main  	at android.app.ActivityThread.access$1400(ActivityThread.java:151)
C 1156.304s Main  	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1357)
C 1156.304s Main  	at android.os.Handler.dispatchMessage(Handler.java:102)
C 1156.304s Main  	at android.os.Looper.loop(Looper.java:135)
C 1156.304s Main  	at android.app.ActivityThread.main(ActivityThread.java:5254)
C 1156.304s Main  	at java.lang.reflect.Method.invoke(Native Method)
C 1156.304s Main  	at java.lang.reflect.Method.invoke(Method.java:372)
C 1156.304s Main  	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
C 1156.304s Main  	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
C 1156.304s Main  Caused by: java.util.EmptyStackException
C 1156.304s Main  	at java.util.Stack.pop(Stack.java:73)
C 1156.304s Main  	at org.chromium.chrome.browser.bookmarks.BookmarkManager.closeSearchUI(BookmarkManager.java:408)
C 1156.304s Main  	at org.chromium.chrome.browser.bookmarks.BookmarkManager.onEndSearch(BookmarkManager.java:446)
C 1156.304s Main  	at org.chromium.chrome.browser.widget.selection.SelectableListToolbar.hideSearchView(SelectableListToolbar.java:399)
C 1156.304s Main  	at org.chromium.chrome.browser.widget.selection.SelectableListToolbar.onDetachedFromWindow(SelectableListToolbar.java:428)
C 1156.304s Main  	at android.view.View.dispatchDetachedFromWindow(View.java:13560)
C 1156.304s Main  	at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:2837)
C 1156.304s Main  	at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:2834)
C 1156.304s Main  	at android.view.ViewGroup.removeViewInternal(ViewGroup.java:4220)
C 1156.304s Main  	at android.view.ViewGroup.removeViewInternal(ViewGroup.java:4193)
C 1156.304s Main  	at android.view.ViewGroup.removeView(ViewGroup.java:4124)
C 1156.304s Main  	at org.chromium.chrome.browser.compositor.CompositorViewHolder.updateContentOverlayVisibility(CompositorViewHolder.java:824)
C 1156.304s Main  	at org.chromium.chrome.browser.compositor.CompositorViewHolder.setTab(CompositorViewHolder.java:855)
C 1156.304s Main  	at org.chromium.chrome.browser.compositor.CompositorViewHolder.shutDown(CompositorViewHolder.java:292)
C 1156.304s Main  	at org.chromium.chrome.browser.ChromeActivity.onDestroy(ChromeActivity.java:1116)
C 1156.304s Main  	at android.app.Activity.performDestroy(Activity.java:6169)
C 1156.304s Main  	at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1141)
C 1156.304s Main  	at android.support.test.runner.MonitoringInstrumentation.callActivityOnDestroy(MonitoringInstrumentation.java:519)
C 1156.304s Main  	at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3693)


 
Looking at the flakiness log https://test-results.appspot.com/dashboards/flakiness_dashboard.html#testType=chrome_public_test_apk&tests=org.chromium.chrome.browser.bookmarks.BookmarkTest%23testSearchBookmarks, it looks as if this has been badly flaky (failing most runs, but occasionally passing) since 2017-5-10.
Cc: twelling...@chromium.org jbudorick@chromium.org yolandyan@chromium.org
The immediate cause seems to be the switch to Junit4 (https://codereview.chromium.org/2856333002). A local build of this as it is currently (with Junit4) failed 9 out of 12 runs. After reverting the changes to BookmarkTest.java from that CL the test ran 20 times without failing.

I suspect the actual problem is a problem with BookmarkManager when the activity is shut down; switching from Junit3 to Junit4 changes how activities are created and destroyed.

As sheriff I will land a CL that switches just BookmarkTest back to Junit3 (I don't want to revert the whole of https://codereview.chromium.org/2856333002), but this needs further investigation.
Labels: OS-Android
Owner: twelling...@chromium.org
Status: Assigned (was: Available)
Components: UI>Browser>Bookmarks
Labels: -undefined Pri-2
Project Member

Comment 6 by bugdroid1@chromium.org, May 15 2017

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

commit 7c66cb42c5d8bb5f5b80a6456ab1d1b0dd259604
Author: Anthony Berent <aberent@chromium.org>
Date: Mon May 15 15:04:44 2017

Switch BookmarkTest back to Junit3

Switching BookmarkTest to Junit4 make testSearchBookmarks very flaky on
tablets. As a short term solutions switch it back to Junit3.

This reverts part of https://codereview.chromium.org/2856333002.

BUG= 722303 

Change-Id: I99b93ea2ee9f1e7463740ebf060bda3e38086f46
Reviewed-on: https://chromium-review.googlesource.com/506010
Reviewed-by: Theresa Wellington <twellington@chromium.org>
Cr-Commit-Position: refs/heads/master@{#471765}
[modify] https://crrev.com/7c66cb42c5d8bb5f5b80a6456ab1d1b0dd259604/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkTest.java

Cc: -yolandyan@chromium.org
Owner: yolandyan@chromium.org
hmm, ya, this should be a JUnit4 problem related to how the activity launch is handled in the activity test rule. I can take a look at this after the majority tests are converted
Cc: yolandyan@chromium.org
Owner: twelling...@chromium.org
As +aberent mentioned in comment2 and told me offline, this is likely not JUnit4 issue. Re assigning back to twellington
More specifically, without investigating this in great detail, the lack of checks for an empty stack before popping the stack in BookmarkManager.closeSearchUI() looked suspicious to me. In all other cases BookmarkManager checks for an empty stack before popping it.
If the search view is showing, there should be something below BookmarkUIState#STATE_SEARCHING on the stack. It is invalid to call closeSearchUI() when the UI is not showing. Here's how the flow is supposed to work:

1) User opens bookmarks, state is pushed on stack
2) User starts a search, causing new state to be pushed on stack
3) User takes some action to hide search view, causing #onEndSearch() to be called
4) Search state is popped off stack, new state is set by popping state from #1 off the stack and pushing it again.

If the stack is empty at 408 that indicates there is no state before the search state or the user wasn't searching when the methods relating to ending a search are called, both of which shouldn't happen.

Note that earlier in the stack trace SelectableListLayout#onDetachedFromWindow() checks if mIsSearching before calling hideSearchView().

There's clearly something going wrong, but checking for an empty stack before popping is not likely the correct solution. I think that instead of calling BookmarkDelegate#closeSearchUI() directly, BookmarkTest should go through the proper SelectableList* widget methods to ensure that SelectableListToolbar is left in the correct state OR #closeSearchUI() should explicitly hide the SelectableListToolbar view if it is still showing.

Fortunately I don't think this represents a real user facing problem but rather a discrepancy in the path the test code exercises vs the actual viable in-product paths.
We should be able to call SelectableListToolbar#hideSearchView() instead of delegate#closeSearchUI() on line 260 of the BookmarkTest. 
Project Member

Comment 12 by bugdroid1@chromium.org, Oct 4 2017

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

commit 6a6e35ff95c1cc413a8930d2e728830842e3fa56
Author: Yoland Yan <yolandyan@chromium.org>
Date: Wed Oct 04 16:35:54 2017

Convert BookmarkTest to JUnit4

This conversion address the search UI unsync issue from crbug/722303.

For more on JUnit4 migration, please check
src/testing/android/docs/junit4.md

Bug: 640116, 722303 
Change-Id: I3f1aeea09e626ca6bdf16ff06bede2afe6387fd3
Reviewed-on: https://chromium-review.googlesource.com/699596
Reviewed-by: Theresa <twellington@chromium.org>
Commit-Queue: Yoland Yan <yolandyan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#506408}
[modify] https://crrev.com/6a6e35ff95c1cc413a8930d2e728830842e3fa56/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkTest.java

Status: Fixed (was: Assigned)

Sign in to add a comment