New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 740207 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Jul 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug



Sign in to add a comment

testHostCachePersistence is flaky

Project Member Reported by avayvod@chromium.org, Jul 7 2017

Issue description

cronet_test_instrumentation_apk failing on chromium.android/Android Cronet Builder Asan

Builders failed on: 
- Android Cronet Builder Asan: 
  https://build.chromium.org/p/chromium.android/builders/Android%20Cronet%20Builder%20Asan


C  250.997s Main  ********************************************************************************
C  250.998s Main  [FAIL] org.chromium.net.ExperimentalOptionsTest#testHostCachePersistence:
C  250.998s Main  java.lang.Throwable: CronetTestBase#runTest failed.
C  250.998s Main  	at org.chromium.net.CronetTestBase.runTest(CronetTestBase.java:197)
C  250.998s Main  	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
C  250.998s Main  	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
C  250.998s Main  	at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554)
C  250.998s Main  	at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1701)
C  250.998s Main  Caused by: java.lang.NullPointerException
C  250.998s Main  	at org.chromium.net.ExperimentalOptionsTest.testHostCachePersistence(ExperimentalOptionsTest.java:182)
C  250.998s Main  	at java.lang.reflect.Method.invokeNative(Native Method)
C  250.999s Main  	at org.chromium.net.CronetTestBase.runTest(CronetTestBase.java:183)
C  250.999s Main  	... 9 more
C  250.999s Main  ********************************************************************************
C  250.999s Main  Summary
C  250.999s Main  ********************************************************************************
C  251.001s Main  [==========] 322 tests ran.
C  251.001s Main  [  PASSED  ] 321 tests.
C  251.001s Main  [  FAILED  ] 1 test, listed below:
C  251.001s Main  [  FAILED  ] org.chromium.net.ExperimentalOptionsTest#testHostCachePersistence
C  251.001s Main  

Somehow the response info seems to be null.
 
Cc: -mge...@chromium.org
Owner: mge...@chromium.org
Status: Assigned (was: Available)

Comment 2 by mge...@chromium.org, Jul 10 2017

Looks like a flake, and it hasn't happened again that I can see. I'm not sure what would cause it. Maybe another case similar to  issue 738442 .

Comment 3 by mge...@chromium.org, Jul 11 2017

Now there's also a case of the first request succeeding and the second request failing. That one is probably caused by the pref not getting written in time.

Comment 4 by mge...@chromium.org, Jul 11 2017

Labels: -Restrict-View-Google
No need to R-V-G this.

Comment 5 by mge...@chromium.org, Jul 12 2017

Cc: mge...@chromium.org
 Issue 741814  has been merged into this issue.
Project Member

Comment 6 by bugdroid1@chromium.org, Jul 13 2017

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

commit db5ca9b349de8a50712af2356f1748941b37da29
Author: Miriam Gershenson <mgersh@chromium.org>
Date: Thu Jul 13 16:22:30 2017

Add delay to wait for prefs in testHostCachePersistence

I'm not sure if this will fix the flake, since I can't repro locally,
but it seems plausible.

BUG= 740207 

Change-Id: Icd423f4221b460bedc31299ec8a69d002d3a9db1
Reviewed-on: https://chromium-review.googlesource.com/570358
Reviewed-by: Misha Efimov <mef@chromium.org>
Commit-Queue: Miriam Gershenson <mgersh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#486407}
[modify] https://crrev.com/db5ca9b349de8a50712af2356f1748941b37da29/components/cronet/android/test/javatests/src/org/chromium/net/ExperimentalOptionsTest.java

Issue 742427 has been merged into this issue.
Doesn't look like it's fixed? 
Here's a flake after the CL:
https://build.chromium.org/p/chromium.android/builders/Android%20Cronet%20KitKat%20Builder/builds/2709

Summary: testHostCachePersistence is flaky (was: cronet_test_instrumentation_apk failing on chromium.android/Android Cronet Builder Asan)
This bug turned out to be weirder than I thought. It's actually three bugs:

1. Given current Cronet API behavior, my test should set either HTTP_CACHE_DISK or HTTP_CACHE_IN_MEMORY, but doesn't. I'll fix that on Monday because it's getting late and no one else is around to lgtm anyway.

2. There's a race condition between creation of the CronetURLRequestAdapter and initialization of the CronetURLRequestContextAdapter on the network thread that causes cache to be enabled when it shouldn't be if a UrlRequest is created immediately after building the CronetEngine. This is why the test only failed 1% of the time instead of consistently failing. When I put in a delay, it started consistently failing.

3. This API behavior is weird. Why does HTTP_CACHE_IN_MEMORY enable DNS cache but HTTP_CACHE_DISK_NO_HTTP doesn't? What is HTTP_CACHE_DISK_NO_HTTP even for? I read our documentation and it doesn't really say. Unfortunately this involves behavior way deep in the net stack and might be tricky to change.

I'll keep this bug for (1) and make separate bugs for (2) and (3).
Can I first disable this test or set it as flaky?

Comment 12 by mef@chromium.org, Jul 17 2017

I've got some background history behind HTTP_CACHE_DISK_NO_HTTP. 

It exists as some of net stack metadata, for example QUIC Server Info used for 0-rtt, was stored in disk cache. This requires HTTP cache to be enabled and configured.

At the same time many apps that use Cronet don't want HTTP responses to be cached as they use app-specific caches at higher levels. 

This is addressed by HTTP_CACHE_DISK_NO_HTTP mode, where metadata is stored in disk cache, but actual http response data is not.

The underlying implementation of HTTP_CACHE_DISK_NO_HTTP implicitly adds net::LOAD_DISABLE_CACHE flag to default load flags: https://cs.chromium.org/chromium/src/components/cronet/android/cronet_url_request_context_adapter.cc?rcl=f4e2fd0da1b5be8802440ada0bbff3aa1ea985af&l=755

It is possible (needs to be confirmed) that setting this flag also disables DNS Cache, which is not desirable.

Project Member

Comment 13 by bugdroid1@chromium.org, Jul 17 2017

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

commit 6ad408ef384a021964d7968abd0e18cb8b902d77
Author: Miriam Gershenson <mgersh@chromium.org>
Date: Mon Jul 17 16:40:28 2017

Enable disk cache in testHostCachePersistence

This fixes the flake.

BUG= 740207 

Change-Id: I68fd807c8bb9effc1c0e9e15e744146c4b1f15c0
Reviewed-on: https://chromium-review.googlesource.com/574571
Reviewed-by: Misha Efimov <mef@chromium.org>
Commit-Queue: Miriam Gershenson <mgersh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#487113}
[modify] https://crrev.com/6ad408ef384a021964d7968abd0e18cb8b902d77/components/cronet/android/test/javatests/src/org/chromium/net/ExperimentalOptionsTest.java

Status: Fixed (was: Assigned)

Sign in to add a comment