Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(504)

Issue 2089783002: [net/cache] Avoid the cache for responses exceeding 2GB. (Closed)

Created:
4 years, 6 months ago by asanka
Modified:
4 years, 5 months ago
Reviewers:
gavinp, mmenke
CC:
cbentzel+watch_chromium.org, chromium-reviews, gavinp+disk_chromium.org, kinuko+cache_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

[net/cache] Skip the cache if the response is expected to exceed 2GB. The state machine in http_cache_transaction doesn't handle partial requests that are larger than numeric_limits<int32_t>::max(). If there is a truncated partial cache entry for a large response, then the cache will try to issue partial requests of size at most numeric_limits<int32_t>::max() bytes until the entire resource is fetched. However, if StopCaching() is called, as it often is for response of this size that are downloaded, then the cache transaction switches to pass through mode. This trips a bug in the state machine where the response would be considered complete once the current partial request completes. There are multiple issues in the cache transaction that needs addressing, but for now we are going to skip the cache entirely if we are likely to hit this case. The partial cache entry is most likely the result of a MIME sniffing attempt and would be insignificant compared to the resource size. Hence skipping the cache in this case isn't expected to regress on performance. This change adds several unit tests that drive a request with a response size of 5GB. These tests are expected to be slower than the average net unit test, but shouldn't cause trouble for the bots. BUG=89567 Committed: https://crrev.com/b5fb4b4394a9c60ee711ee9f434072a7e7aee513 Cr-Commit-Position: refs/heads/master@{#402774}

Patch Set 1 #

Patch Set 2 : . #

Total comments: 10

Patch Set 3 : Address mmenke's comments #

Total comments: 14

Patch Set 4 : Address comments. #

Patch Set 5 : Fix build for configurations where DCHECK is disabled. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+371 lines, -58 lines) Patch
M net/http/http_cache_transaction.cc View 1 2 1 chunk +22 lines, -2 lines 0 comments Download
M net/http/http_cache_unittest.cc View 1 2 3 4 chunks +277 lines, -13 lines 0 comments Download
M net/http/http_transaction_test_util.h View 4 chunks +17 lines, -5 lines 0 comments Download
M net/http/http_transaction_test_util.cc View 11 chunks +43 lines, -37 lines 0 comments Download
M net/http/mock_http_cache.cc View 1 2 3 4 3 chunks +12 lines, -1 line 0 comments Download

Messages

Total messages: 16 (7 generated)
asanka
mmenke: Would you do the honors? Some background in https://bugs.chromium.org/p/chromium/issues/detail?id=89567#c132 The longer term fix would ...
4 years, 6 months ago (2016-06-22 02:15:46 UTC) #2
mmenke
[+gavinp] Some quick comments, but I think Gavin would be a better reviewer here - ...
4 years, 6 months ago (2016-06-22 15:50:26 UTC) #4
asanka
https://codereview.chromium.org/2089783002/diff/20001/net/http/http_cache_transaction.cc File net/http/http_cache_transaction.cc (right): https://codereview.chromium.org/2089783002/diff/20001/net/http/http_cache_transaction.cc#newcode1178 net/http/http_cache_transaction.cc:1178: const int64_t full_response_length = response_.headers->GetContentLength(); On 2016/06/22 at 15:50:26, ...
4 years, 6 months ago (2016-06-22 16:31:22 UTC) #6
gavinp
lgtm, none of my nits are serious. There's a theme around casting and the 2GB ...
4 years, 5 months ago (2016-06-28 14:24:43 UTC) #7
mmenke
nit: Your description is wrong. This CL avoids the cache for responses that are at ...
4 years, 5 months ago (2016-06-28 14:31:18 UTC) #8
asanka
Thanks! mmenke, gavinp: I updated the CL description to be more.. descriptive. PTAL? https://codereview.chromium.org/2089783002/diff/60001/net/http/http_cache_unittest.cc File ...
4 years, 5 months ago (2016-06-28 16:55:38 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2089783002/100001
4 years, 5 months ago (2016-06-29 11:02:16 UTC) #13
commit-bot: I haz the power
Committed patchset #5 (id:100001)
4 years, 5 months ago (2016-06-29 11:06:24 UTC) #14
commit-bot: I haz the power
4 years, 5 months ago (2016-06-29 11:08:03 UTC) #16
Message was sent while issue was closed.
Patchset 5 (id:??) landed as
https://crrev.com/b5fb4b4394a9c60ee711ee9f434072a7e7aee513
Cr-Commit-Position: refs/heads/master@{#402774}

Powered by Google App Engine
This is Rietveld 408576698