New issue
Advanced search Search tips

Issue 758401 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner:
Closed: Sep 13
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug



Sign in to add a comment

Two of Cronet NQE Tests are flaky

Project Member Reported by kapishnikov@chromium.org, Aug 23 2017

Issue description

There is a race condition in the NQETest#testPrefsWriteRead & NQETest#testQuicDisabled tests. Namely, the main thread is trying to execute the native method ConfigureNetworkQualityEstimatorForTesting while the Cronet initialization thread is trying to execute the native InitRequestContextOnInitThread method. If due to the CPU scheduling the initialization thread completes all tasks before the ConfigureNetworkQualityEstimatorForTesting method posts to the network thread, the tests will fail.

In order to reproduce the issue, it is enough to introduce a small delay in the CronetURLRequestContextAdapter::ConfigureNetworkQualityEstimatorForTesting(...) method before it posts to the network thread. Here is the diff:

+++ b/components/cronet/android/cronet_url_request_context_adapter.cc
@@ -547,6 +547,7 @@ void CronetURLRequestContextAdapter::ConfigureNetworkQualityEstimatorForTesting(
     jboolean use_local_host_requests,
     jboolean use_smaller_responses,
     jboolean disable_offline_check) {
+  sleep(3);
   PostTaskToNetworkThread(
       FROM_HERE,
       base::Bind(&CronetURLRequestContextAdapter::
 
We don't see the failures often because the InitializeOnNetworkThread() method posts the execution of InitializeNQEPrefsOnNetworkThread() to the network thread (same thread). This significantly increases the chance of ConfigureNetworkQualityEstimatorOnNetworkThreadForTesting() executing first. It should not be necessary to post tasks from networks thread to the same thread during the initialization.

      network_qualities_prefs_manager_ =
          base::MakeUnique<net::NetworkQualitiesPrefsManager>(
              base::MakeUnique<NetworkQualitiesPrefDelegateImpl>(
                  pref_service_.get()));
      PostTaskToNetworkThread(FROM_HERE,
                              base::Bind(&CronetURLRequestContextAdapter::
                                             InitializeNQEPrefsOnNetworkThread,
                                         base::Unretained(this)));

Comment 2 Deleted

Comment 3 Deleted

Comment 4 by mmenke@chromium.org, Aug 24 2017

Oops...wrong bug.  :)
Cc: tbansal@chromium.org
Cc: -tbansal@chromium.org
Owner: tbansal@chromium.org
Status: Assigned (was: Untriaged)
Issue 831213 has been merged into this issue.
Labels: sheriff-android
I confirm this test fails sometimes:
https://ci.chromium.org/buildbot/chromium.android/Android%20Cronet%20Builder%20%28dbg%29/9924

It appeared today in the 'Tree closers' section.
https://sheriff-o-matic.appspot.com/android.
It is flaky, so it will probably be gone in the next build.
Status: WontFix (was: Assigned)
Looks like this hasn't failed again in the past 100 builds.
https://ci.chromium.org/buildbot/chromium.android/Android%20Cronet%20Builder%20%28dbg%29/?limit=100

Sign in to add a comment