New issue
Advanced search Search tips

Issue 844009 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: May 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Fuchsia
Pri: 3
Type: Bug



Sign in to add a comment

TaskSchedulerWorkerPoolHistogramTest.NumTasksBeforeCleanup failure on Fuschia

Project Member Reported by fdoray@chromium.org, May 17 2018

Issue description

Link to failure: https://logs.chromium.org/v/?s=chromium%2Fbb%2Fchromium.fyi%2FFuchsia__dbg_%2F19577%2F%2B%2Frecipes%2Fsteps%2Fbase_unittests%2F0%2Flogs%2FTaskSchedulerWorkerPoolHistogramTest.NumTasksBeforeCleanup%2F0

[ RUN      ] TaskSchedulerWorkerPoolHistogramTest.NumTasksBeforeCleanup
../../base/task_scheduler/scheduler_worker_pool_impl_unittest.cc:732: Failure
Expected equality of these values:
  *thread_ref
    Which is: 8-byte object <38-DB 63-46 63-27 00-00>
  PlatformThread::CurrentRef()
    Which is: 8-byte object <38-0B 21-B9 45-14 00-00>
Stack trace:
bt#00: pc 0x41826b4fd88f (libbase.so,0x41888f)
bt#01: end
../../base/task_scheduler/scheduler_worker_pool_impl_unittest.cc:763: Failure
Expected: (thread_ref) != (PlatformThread::CurrentRef()), actual: 8-byte object <38-DB 63-46 63-27 00-00> vs 8-byte object <38-DB 63-46 63-27 00-00>
Worker reused. Worker will not cleanup and the histogram value will be wrong.
Stack trace:
bt#00: pc 0x41826b4fd88f (libbase.so,0x41888f)
bt#01: end
../../base/task_scheduler/scheduler_worker_pool_impl_unittest.cc:784: Failure
Expected equality of these values:
  0
  histogram->SnapshotSamples()->GetCount(1)
    Which is: 1
Stack trace:
bt#00: pc 0x4abf9b607009 (app:/pkg/bin/app,0x142b009)
bt#01: pc 0x4abf9b6229e7 (app:/pkg/bin/app,0x14469e7)
bt#02: pc 0x4abf9b621d87 (app:/pkg/bin/app,0x1445d87)
bt#03: pc 0x4abf9b1b8882 (app:/pkg/bin/app,0xfdc882)
bt#04: pc 0x4abf9b5caa4e (app:/pkg/bin/app,0x13eea4e)
bt#05: end
../../base/task_scheduler/scheduler_worker_pool_impl_unittest.cc:786: Failure
Expected equality of these values:
  1
  histogram->SnapshotSamples()->GetCount(3)
    Which is: 0
Stack trace:
bt#00: pc 0x4abf9b607009 (app:/pkg/bin/app,0x142b009)
bt#01: pc 0x4abf9b6229e7 (app:/pkg/bin/app,0x14469e7)
bt#02: pc 0x4abf9b621d87 (app:/pkg/bin/app,0x1445d87)
bt#03: pc 0x4abf9b1b8cc7 (app:/pkg/bin/app,0xfdccc7)
bt#04: pc 0x4abf9b5caa4e (app:/pkg/bin/app,0x13eea4e)
bt#05: end
[  FAILED  ] TaskSchedulerWorkerPoolHistogramTest.NumTasksBeforeCleanup (507 ms)

A pool should always have one alive worker, so it is unlikely that the worker that ran the 2 first tasks was cleaned up by the time the 3rd task runs. However, this could happen:

1. Worker #1: Runs a tasks and empties the sequence, without adding itself to the idle stack yet.
2. Posting thread:   Posts another task to the now empty sequence. Wakes up a new worker, since worker #1 isn't on the idle stack yet.
3. Worker #2: Runs the tasks, violating the expectation that the 3 initial tasks run on the same worker.
 
Project Member

Comment 1 by bugdroid1@chromium.org, May 17 2018

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

commit 0181d8b347f33ec1767ce0e244d73e97aff239ac
Author: Francois Doray <fdoray@chromium.org>
Date: Thu May 17 14:54:27 2018

Fix TaskSchedulerWorkerPoolHistogramTest.NumTasksBeforeCleanup failure on Fuschia.

This test assumes that 3 tasks posted to the same sequence from the
main thread will be scheduled on the same worker. This is incorrect
because of this:

1. Worker #1: Runs a tasks and empties the sequence, without adding
   itself to the idle stack yet.
2. Posting thread: Posts another task to the now empty sequence.
   Wakes up a new worker, since worker #1 isn't on the idle stack yet.
3. Worker #2: Runs the tasks, violating the expectation that the
   3 initial tasks run on the same worker.

This CL fixes the issue by starting the pool *after* the 3 tasks
have been posted.

Bug:  844009 
Change-Id: Idcc74e8bea90b94ecba8e3a52abc4091c89044b2
Reviewed-on: https://chromium-review.googlesource.com/1064016
Reviewed-by: Gabriel Charette <gab@chromium.org>
Commit-Queue: François Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/master@{#559534}
[modify] https://crrev.com/0181d8b347f33ec1767ce0e244d73e97aff239ac/base/task_scheduler/scheduler_worker_pool_impl_unittest.cc

Comment 2 by fdoray@chromium.org, May 18 2018

Status: Fixed (was: Started)

Sign in to add a comment