New issue
Advanced search Search tips

Issue 789712 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Dec 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Chrome , Mac , Fuchsia
Pri: 2
Type: Bug

Blocking:
issue 738275



Sign in to add a comment

ScopedTaskEnvironmentTest.DelayedTasks test is inherently flaky

Project Member Reported by w...@chromium.org, Nov 29 2017

Issue description

Since build https://ci.chromium.org/buildbot/chromium.fyi/Fuchsia/11718, various of the variants of this test have been flaking, e.g:

[ RUN      ] MainThreadMockTime/ScopedTaskEnvironmentTest.DelayedTasks/0
../../base/test/scoped_task_environment_unittest.cc:195: Failure
      Expected: expected_value
      Which is: 0
To be equal to: counter
      Which is: 2
[  FAILED  ] MainThreadMockTime/ScopedTaskEnvironmentTest.DelayedTasks/0, where GetParam() = 4-byte object <01-00 00-00> (51 ms)

or

[ RUN      ] MainThreadDefault/ScopedTaskEnvironmentTest.DelayedTasks/0
../../base/test/scoped_task_environment_unittest.cc:195: Failure
      Expected: expected_value
      Which is: 0
To be equal to: counter
      Which is: 2
[  FAILED  ] MainThreadDefault/ScopedTaskEnvironmentTest.DelayedTasks/0, where GetParam() = 4-byte object <00-00 00-00> (59 ms)

or

[ RUN      ] MainThreadIO/ScopedTaskEnvironmentTest.DelayedTasks/0
../../base/test/scoped_task_environment_unittest.cc:195: Failure
      Expected: expected_value
      Which is: 0
To be equal to: counter
      Which is: 2
[  FAILED  ] MainThreadIO/ScopedTaskEnvironmentTest.DelayedTasks/0, where GetParam() = 4-byte object <03-00 00-00> (46 ms)

etc

All the failures involve an |expected_value| of zero, but a |counter| value of two.

There are no obvious culprits in the blame list for https://ci.chromium.org/buildbot/chromium.fyi/Fuchsia/11718 though.
 

Comment 1 by w...@chromium.org, Nov 29 2017

Blocking: 738275

Comment 2 by w...@chromium.org, Nov 29 2017

Cc: scottmg@chromium.org
Thanks for filing, hadn't had a chance to look into this yet.

It's been happening for a while, at least as far back as https://build.chromium.org/p/chromium.fyi/builders/Fuchsia/builds/11473 so perhaps https://chromium-review.googlesource.com/638550 based on that blamelist. If not it might be worth looking at other recent CLs in the bug linked there.

Comment 4 by w...@chromium.org, Dec 2 2017

Cc: gab@chromium.org
Re #3: The failing test was indeed added in https://chromium-review.googlesource.com/638550. Looking at the test implementation, it sets up an asynchronous ScopedTaskEnvironment with "async" execution mode, but then seems to expect that work passed to PostTask() won't be executed until RunUntilIdle().

Comment 5 by w...@chromium.org, Dec 2 2017

Components: Internals>TaskScheduler
Labels: OS-Android OS-Chrome OS-Linux OS-Mac OS-Windows
Status: Started (was: Assigned)
Summary: ScopedTaskEnvironmentTest.DelayedTasks test is inherently flaky (was: ScopedTaskEnvironmentTest.DelayedTasks fails frequently)
Project Member

Comment 6 by bugdroid1@chromium.org, Dec 2 2017

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

commit f63253ce95cedeeac95cad6951545b872872e229
Author: Wez <wez@chromium.org>
Date: Sat Dec 02 22:22:41 2017

Fix ScopedTaskEnvironmentTest.DelayedTasks to not be racey.

The test created an ASYNC-mode ScopedTaskEnvironment, but then applied
expectations to it that are only valid in QUEUED (synchronous) mode. The
test is fixed to use a QUEUED-mode instance.

A brief delay is also added to the test, to make it more likely to fail
if the behaviour regresses to being asynchronous & racey.

Bug:  789712 
TBR: gab
Change-Id: I73808b1633bd7afcb6e0204a4030e16ef323f868
Reviewed-on: https://chromium-review.googlesource.com/804691
Reviewed-by: Wez <wez@chromium.org>
Commit-Queue: Wez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#521221}
[modify] https://crrev.com/f63253ce95cedeeac95cad6951545b872872e229/base/test/scoped_task_environment_unittest.cc

Comment 7 by w...@chromium.org, Dec 3 2017

Status: Fixed (was: Started)
Project Member

Comment 8 by bugdroid1@chromium.org, Dec 4 2017

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

commit e7e2294286d78156b3f21bdbaf50eb69d79f820c
Author: Wez <wez@chromium.org>
Date: Mon Dec 04 20:34:07 2017

Tweak ScopedTaskEnvironmentTest comments as per code-review requests.

Bug:  789712 
TBR: gab
Change-Id: I16e059c18420a56e875c5564015531177bc213d3
Reviewed-on: https://chromium-review.googlesource.com/806815
Reviewed-by: Gabriel Charette <gab@chromium.org>
Reviewed-by: François Doray <fdoray@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#521434}
[modify] https://crrev.com/e7e2294286d78156b3f21bdbaf50eb69d79f820c/base/test/scoped_task_environment_unittest.cc

Sign in to add a comment