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

Issue 160447: Add checks to DEBUG mode that no instance of URLRequest or URLFetcher survive... (Closed)

Created:
11 years, 4 months ago by eroman
Modified:
9 years, 6 months ago
CC:
chromium-reviews_googlegroups.com, darin (slow to review), brettw, willchan no longer on Chromium, Ben Goodger (Google)
Visibility:
Public.

Description

Add checks to DEBUG mode that no instance of URLRequest or URLFetcher survives the destruction of the IO thread. This checking is done by introducing a new helper class to base called LeakTracker. Classes that you want to check for leaks just need to extend LeakTracker. The reason I am picking on URLFetcher / URLRequest, is I believe we have a bug that is making an instance of URLFetcher to outlive the IO thread. This causes various sorts of badness. For example: If URLFetcher survives the IO thread, then URLRequestContext remains referenced and therefore also survives IO thread. In turn HostResolverImpl survives the IO thread, so any outstanding resolve requests are NOT cancelled before the IO thread is decomissioned. So now, when the worker thread doing the DNS resolve finally finishes (assuming it finishes before the rogue URLRequest is destroyed), it post the result to a defunct message loop. KAB00m! (http://crbug.com/15513) Moreover, I believe we hit this same problem sporadically in AutomationProxyTest.AutocompleteGetSetText -- the test is flaky on the buildbots, and I've seen DCHECKs which suggest it is related to this issue. BUG=http://crbug.com/18372 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=23084

Patch Set 1 #

Patch Set 2 : Update some comments #

Patch Set 3 : move into base:: #

Total comments: 10

Patch Set 4 : Address darin's comments #

Patch Set 5 : style-nit: Remove an empty line #

Patch Set 6 : Chain CleanUp #

Patch Set 7 : Add call to Stop() in dtor -- this still doesnt work #

Patch Set 8 : remove todo comment #

Patch Set 9 : add back something which got accidentally deleted #

Total comments: 2

Patch Set 10 : Address darin's comments #

Patch Set 11 : Improve some comments #

Total comments: 4

Patch Set 12 : Fix a blatant compile error #

Patch Set 13 : Add a no-op CheckForLeaks test #

Patch Set 14 : Sync client #

Unified diffs Side-by-side diffs Delta from patch set Stats (+647 lines, -11 lines) Patch
M base/base.gyp View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +4 lines, -0 lines 0 comments Download
A base/leak_tracker.h View 1 2 3 4 5 6 7 8 9 1 chunk +106 lines, -0 lines 0 comments Download
A base/leak_tracker_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +108 lines, -0 lines 0 comments Download
A base/linked_list.h View 10 1 chunk +135 lines, -0 lines 0 comments Download
A base/linked_list_unittest.cc View 1 chunk +245 lines, -0 lines 0 comments Download
M chrome/browser/browser_process_impl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +4 lines, -0 lines 0 comments Download
M chrome/browser/browser_process_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 6 chunks +39 lines, -11 lines 0 comments Download
M chrome/browser/net/url_fetcher.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +3 lines, -0 lines 0 comments Download
M net/url_request/url_request.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +3 lines, -0 lines 0 comments Download

Messages

Total messages: 13 (0 generated)
eroman
11 years, 4 months ago (2009-07-31 08:36:15 UTC) #1
darin (slow to review)
more comments soon... http://codereview.chromium.org/160447/diff/31/39 File chrome/browser/net/url_fetcher.cc (right): http://codereview.chromium.org/160447/diff/31/39#newcode245 Line 245: request_context_ = NULL; I don't ...
11 years, 4 months ago (2009-07-31 17:03:11 UTC) #2
eroman
http://codereview.chromium.org/160447/diff/31/39 File chrome/browser/net/url_fetcher.cc (right): http://codereview.chromium.org/160447/diff/31/39#newcode245 Line 245: request_context_ = NULL; On 2009/07/31 17:03:11, darin wrote: ...
11 years, 4 months ago (2009-07-31 18:41:43 UTC) #3
darin (slow to review)
Very sorry for not reviewing sooner. This looks great. I have some suggestions for possible ...
11 years, 4 months ago (2009-08-06 06:11:48 UTC) #4
eroman
Thanks for the review comments! I will be out vacationing tomorrow, but will try to ...
11 years, 4 months ago (2009-08-06 06:35:20 UTC) #5
eroman
http://codereview.chromium.org/160447/diff/31/35 File base/leak_tracker.h (right): http://codereview.chromium.org/160447/diff/31/35#newcode79 Line 79: static LeakTrackerImpl tracker; On 2009/08/06 06:11:48, darin wrote: ...
11 years, 4 months ago (2009-08-07 19:05:12 UTC) #6
darin (slow to review)
On Fri, Aug 7, 2009 at 12:05 PM, <eroman@chromium.org> wrote: > > http://codereview.chromium.org/160447/diff/31/35 > File ...
11 years, 4 months ago (2009-08-08 03:52:15 UTC) #7
darin (slow to review)
http://codereview.chromium.org/160447/diff/3055/2046 File base/leak_tracker.h (right): http://codereview.chromium.org/160447/diff/3055/2046#newcode89 Line 89: class LinkedList { not necessarily fodder for this ...
11 years, 4 months ago (2009-08-10 06:18:01 UTC) #8
eroman
> No, I was suggesting not doing any of that. Oh, now I get what ...
11 years, 4 months ago (2009-08-10 21:34:59 UTC) #9
eroman
http://codereview.chromium.org/160447/diff/3055/2046 File base/leak_tracker.h (right): http://codereview.chromium.org/160447/diff/3055/2046#newcode89 Line 89: class LinkedList { On 2009/08/10 06:18:01, darin wrote: ...
11 years, 4 months ago (2009-08-11 02:16:41 UTC) #10
darin (slow to review)
beautiful! thanks for going the extra distance here. just a couple trivial snags and then ...
11 years, 4 months ago (2009-08-11 03:55:43 UTC) #11
eroman
http://codereview.chromium.org/160447/diff/2069/3072 File chrome/browser/browser_process_impl.cc (right): http://codereview.chromium.org/160447/diff/2069/3072#newcode109 Line 109: URLFetcher::CheckForLeaks(); On 2009/08/11 03:55:43, darin wrote: > these ...
11 years, 4 months ago (2009-08-11 19:10:12 UTC) #12
darin (slow to review)
11 years, 4 months ago (2009-08-11 19:11:58 UTC) #13
LGTM

Powered by Google App Engine
This is Rietveld 408576698