New issue
Advanced search Search tips

Issue 792173 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Jun 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , iOS , Mac , Fuchsia
Pri: 1
Type: Bug

Blocked on:
issue 640621

Blocking:
issue 816143



Sign in to add a comment

[Cronet] StaleHostResolverTest.StaleUsability test is inherently flaky

Project Member Reported by mef@chromium.org, Dec 5 2017

Issue description

There is a flaky failure. 
NOTE: There is currently no way to run unittests on bots until crbug/640621 is fixed.

[92607:33795:1205/135718.710349:419609004253625:ERROR:dns_config_service_posix.cc(233)] DNS config watch failed to start.
../../components/cronet/stale_host_resolver_unittest.cc:452: Failure
      Expected: test_case.error
      Which is: 0
To be equal to: resolve_error()
      Which is: -21
3
../../components/cronet/stale_host_resolver_unittest.cc:457: Failure
      Expected: expected
      Which is: "1.1.1.1"
To be equal to: resolve_addresses()[0].ToStringWithoutPort()
      Which is: "3.3.3.3"
3



For graphics-related bugs, please copy/paste the contents of the about:gpu
page at the end of this report.

 

Comment 1 by mef@chromium.org, Dec 5 2017

Blockedon: 640621

Comment 2 by mef@chromium.org, Feb 26 2018

Blocking: 816143

Comment 3 by mge...@chromium.org, Mar 23 2018

Owner: ----
Status: Available (was: Assigned)

Comment 4 by w...@chromium.org, Apr 4 2018

Running these tests on Linux, under ASAN, I just saw a similar flake:

../../components/cronet/stale_host_resolver_unittest.cc:468: Failure
Expected equality of these values:
  test_case.error
    Which is: 0
  resolve_error()
    Which is: -21
4
../../components/cronet/stale_host_resolver_unittest.cc:473: Failure
Expected equality of these values:
  expected
    Which is: "2.2.2.2"
  resolve_addresses()[0].ToStringWithoutPort()
    Which is: "3.3.3.3"
4

Are these tests relying on real-time clock values, rather than running against a controlled test clock?

Comment 5 by w...@chromium.org, Apr 4 2018

Labels: -Pri-3 M-68 OS-Android OS-Fuchsia OS-Linux OS-Mac OS-Windows Pri-1
Summary: [Cronet] StaleHostResolverTest.StaleUsability test is inherently flaky (was: [Cronet] StaleHostResolverTest.StaleUsability is failing on iOS.)
This test (and presumably others in this suite) is/are inherently flaky because they do not use a mock clock, so thread scheduling delays can alter their behaviour -> bumping to P1 since this will affect CQ, try-bots, etc stability.

Specifically the test suite's CreateCacheEntry inserts a cache entry based on the requested Time-To-Live, relative to Now(), then does some more work depending on the test, then calls Resolve(). If a delay occurs between CreateCacheEntry() and Resolve() then the test may observe the wrong results; this can occur if e.g. the host running the test is under heavy load.

You can trivially repro this failure-mode by introducing a one-second Sleep() between the two calls.

Comment 6 by mef@chromium.org, Apr 5 2018

Owner: mef@chromium.org
Status: Assigned (was: Available)

Comment 7 by mef@chromium.org, Apr 7 2018

Components: Internals>Network>DNS
Looking at net/dns/host_cache.cc it uses base::Time::Now() and base::TimeTicks::Now() directly, for example:

    base::TimeTicks expiration_time =
        base::TimeTicks::Now() -
        (base::Time::Now() - base::Time::FromInternalValue(time_internal));

IIUIC this means that we should change not only test but also underlying implementation.

Comment 8 by w...@chromium.org, Apr 7 2018

Re #7: There were "seams" added to base::Time/TimeTicks/ThreadTicks::Now() (see https://cs.chromium.org/chromium/src/base/time/time_override.h) that allow time to be mocked without dependency injection. The seams apply process-wide, though, so perhaps are unsuitable.
 Issue 836022  has been merged into this issue.
Can we disable this test until the flakiness has been fixed?

Comment 11 by mef@chromium.org, Apr 23 2018

Disabling test until flakiness is fixed sgtm.
Test was disabled in r553020
 Issue 836106  has been merged into this issue.
Project Member

Comment 14 by bugdroid1@chromium.org, May 30 2018

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

commit b99e7da3ec5b3adc77d2512ec0bfacca65e5a019
Author: Misha Efimov <mef@chromium.org>
Date: Wed May 30 16:59:02 2018

[Cronet] Fix flaky StaleHostResolverTest.StaleUsability test.

- Use base::SimpleTestTickClock to provide deterministic time.
- Use net::test::MockNetworkChangeNotifier to avoid notifications from real NCN.

Bug:  792173 
Cq-Include-Trybots: master.tryserver.chromium.android:android_cronet_tester;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I6e9b20363452a1e665b133960167551808486b48
Reviewed-on: https://chromium-review.googlesource.com/1067958
Reviewed-by: Paul Jensen <pauljensen@chromium.org>
Commit-Queue: Misha Efimov <mef@chromium.org>
Cr-Commit-Position: refs/heads/master@{#562874}
[modify] https://crrev.com/b99e7da3ec5b3adc77d2512ec0bfacca65e5a019/components/cronet/stale_host_resolver.cc
[modify] https://crrev.com/b99e7da3ec5b3adc77d2512ec0bfacca65e5a019/components/cronet/stale_host_resolver.h
[modify] https://crrev.com/b99e7da3ec5b3adc77d2512ec0bfacca65e5a019/components/cronet/stale_host_resolver_unittest.cc
[modify] https://crrev.com/b99e7da3ec5b3adc77d2512ec0bfacca65e5a019/net/dns/host_cache.cc
[modify] https://crrev.com/b99e7da3ec5b3adc77d2512ec0bfacca65e5a019/net/dns/host_cache.h
[modify] https://crrev.com/b99e7da3ec5b3adc77d2512ec0bfacca65e5a019/net/dns/host_resolver_impl.cc
[modify] https://crrev.com/b99e7da3ec5b3adc77d2512ec0bfacca65e5a019/net/dns/host_resolver_impl.h

Comment 15 by mef@chromium.org, Jun 4 2018

Labels: -M-68 M-69
Status: Fixed (was: Assigned)

Sign in to add a comment