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

Issue 752954 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Aug 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocking:
issue 757458



Sign in to add a comment

Potential memory leak in chrome_browser_net::Predictor

Project Member Reported by etienneb@chromium.org, Aug 7 2017

Issue description

These results are produced by running an chrome extension that randomly browse the web for multiple days. Chrome is running with native-heap-profiling activated and memory allocations are tracked.

The attached stackframes shows where the leaking memory got allocated.

The bug was on windows 10 canary M61.

 
bug1.png
41.4 KB View Download
More stackframes
bug1.png
49.1 KB View Download
bug2.png
43.5 KB View Download
see: https://cs.chromium.org/chromium/src/chrome/browser/net/predictor.cc?l=1003


  UrlInfo* info = &results_[url];
  info->SetUrl(url);  // Initialize or DCHECK.
  // TODO(jar):  I need to discard names that have long since expired.
  // Currently we only add to the domain map :-/


Data can be cleared with |Predictor::DiscardAllResults|.
This is not called on a regular basis, thus |results_| keep growing over time.
As shown in the bug1.png of #c1, there is about 25k objects leaked which is consuming 11.2M of memory.
Summary: Potential memory leak in chrome_browser_net::Predictor (was: Potential memory leak in net::Predictor)
Components: Internals>Network
Cc: xunji...@chromium.org
Cc: lizeb@chromium.org csharrison@chromium.org
I briefly looked at the code and I think we can simply replace DnsProcessingState::ASSIGNED with DnsProcessingState::ASSIGNED_BUT_MARKED to ensure deletion after resolution.

After resolution is complete I think the only consumer of the information is about:dns.

lizeb@ could you take this on your plate?
Cc: -lizeb@chromium.org
Owner: lizeb@chromium.org
Status: Assigned (was: Untriaged)
lizeb@: i am assigning this to you since you are actively working on Predictor. Please re-assign as needed.

Comment 10 by lizeb@chromium.org, Aug 10 2017

Cc: lizeb@chromium.org
Owner: alexilin@chromium.org
Assigning it to Alex who has looked at this most recently.
Blocking: 757458
Project Member

Comment 12 by bugdroid1@chromium.org, Aug 22 2017

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

commit f644065628d4fc088f5deac6ab9464d350f7b361
Author: Alexandr Ilin <alexilin@chromium.org>
Date: Tue Aug 22 15:46:32 2017

net: Delete UrlInfo after DNS resolution

The Predictor keeps in memory a UrlInfo object for all hosts that it tries to
preresolve and never discards them (except if the user clears the browsing
data). This causes memory leaks.

After resolution is complete the map of UrlInfos is used to deduplicate DNS
requests to already seen hosts that we beleive are still in the browser DNS
cache. The another consumer of the information is about:dns.

The additional layer of caching for DNS requests is unnecessary so this CL
simply sets the DnsProcessingState::ASSIGNED_BUT_MARKED state instead of
DnsProcessingState::ASSIGNED to ensure deletion in Predictor::LookupFinished().

Bug:  752954 ,  757458 
Change-Id: I8a6734b071f19ab289a7be5dedc7794266854e6d
Reviewed-on: https://chromium-review.googlesource.com/612380
Commit-Queue: Alexandr Ilin <alexilin@chromium.org>
Reviewed-by: Charlie Harrison <csharrison@chromium.org>
Reviewed-by: Helen Li <xunjieli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#496315}
[modify] https://crrev.com/f644065628d4fc088f5deac6ab9464d350f7b361/chrome/browser/net/predictor.cc
[modify] https://crrev.com/f644065628d4fc088f5deac6ab9464d350f7b361/chrome/browser/net/predictor.h
[modify] https://crrev.com/f644065628d4fc088f5deac6ab9464d350f7b361/chrome/browser/net/predictor_browsertest.cc
[modify] https://crrev.com/f644065628d4fc088f5deac6ab9464d350f7b361/chrome/browser/net/url_info.cc
[modify] https://crrev.com/f644065628d4fc088f5deac6ab9464d350f7b361/chrome/browser/net/url_info.h

Status: Fixed (was: Assigned)
Now it should be fixed.

Sign in to add a comment