Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Issue 1634693002: Fix race condition in InstallerDelegateTest. (Closed)

Created:
4 years, 11 months ago by mattcary
Modified:
4 years, 11 months ago
Reviewers:
pasko, gone
CC:
chromium-reviews
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Fix race condition in InstallerDelegateTest. Remove the unnecessary and dangerous polling in startMonitoring(). mTestDelegate.mIsRunning is set directly in start(), so waiting for mTestDelegate.isRunning() does not guarantee anything. However, it does introduce the possibility of a race if the mHandler.postDelayed() call in mTestDelegate.start() switches threads. Precisely, if mHandler.postDelayed() stays in the same thread, or causes uninteresting thread switches, the following happens in startMonitoring: mTestDelegate.start -> mIsRunning = true; ... CriteriaHelper.pollForCriteria -> mTestDeleted.isRunning() == true, exit immediately. On the other hand, if there is an interesting thread switch in mHandler.postDelayed(), then we could have mTestDelegate.start -> mIsRunning = true; mHandler.postDelayed() ... stuff happens ... mTestDelegate.run() is called mIsRunning = false; ... more stuff happens .. (now back to main test thread) CriteriaHelper.pollForCriteria -> mTestDeleted.isRunning() == false, loop until timeout and the test fails. Before removing this poll, running locally the test occasionally retried tests on a nexus 4; after removing it it ran 20 times successfully with no retries. I think we have slightly higher confidence now that it won't flake on the build. BUG=542627 Committed: https://crrev.com/b4ffd219c5633ddd3eaa4ee20832e83cc0320e31 Cr-Commit-Position: refs/heads/master@{#371477}

Patch Set 1 #

Patch Set 2 : Remove flaky test #

Unified diffs Side-by-side diffs Delta from patch set Stats (+0 lines, -11 lines) Patch
M chrome/android/javatests/src/org/chromium/chrome/browser/banners/InstallerDelegateTest.java View 1 3 chunks +0 lines, -11 lines 0 comments Download

Messages

Total messages: 11 (6 generated)
gone
lgtm
4 years, 11 months ago (2016-01-25 18:20:13 UTC) #4
pasko
lgtm, thank you
4 years, 11 months ago (2016-01-25 18:43:42 UTC) #5
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1634693002/20001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1634693002/20001
4 years, 11 months ago (2016-01-26 08:07:50 UTC) #7
commit-bot: I haz the power
Committed patchset #2 (id:20001)
4 years, 11 months ago (2016-01-26 08:40:21 UTC) #9
commit-bot: I haz the power
4 years, 11 months ago (2016-01-26 08:41:33 UTC) #11
Message was sent while issue was closed.
Patchset 2 (id:??) landed as
https://crrev.com/b4ffd219c5633ddd3eaa4ee20832e83cc0320e31
Cr-Commit-Position: refs/heads/master@{#371477}

Powered by Google App Engine
This is Rietveld 408576698