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

Issue 1536533004: [tracing] Simplify logic of MemoryDumpManager (Closed)

Created:
5 years ago by Primiano Tucci (use gerrit)
Modified:
5 years ago
CC:
chromium-reviews, tracing+reviews_chromium.org, wfh+watch_chromium.org, vmpstr+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

[tracing] Simplify logic of MemoryDumpManager This CL simplifies the unregistration logic of MemoryDumpManager. This is to make the overall code more readable and simplify upcoming changes. Prior to this CL, the MemoryDumpManager was keeping only one list to keep track of the registered dump providers. This caused the unregistration logic to be tricky because: - We couldn't remove the MDPInfo straight away, as that might cause invalidation of the |next_dump_provider| iterator. - We had to flag the MDPInfo as unregistered and postpone the deletion on the next dump. This has a major drawback: if we keep registering and unregistering dump providers when no tracing is happening at all, the dump_providers_ list grows without bounds. This is bad. This CL changes the logic as follows: - MDPInfo becomes refcounted. At any time it can be referenced by: - The MDM's |dump_providers_| list. - The |ProcessMemoryDumpAsyncState.pending_dump_providers| list. - Upon each dump, the dump provider list is snapshotted in the |ProcessMemoryDumpAsyncState.pending_dump_providers| - Upon unregistration of a dump provider we just remove the MDPInfo from the MDM's |dump_providers_|. If a dump is ongoing, the ProcessMemoryDumpAsyncState will keep it refcounted and delete it during the dump. This CL does not add or change any behavior of the MemoryDumpManager, with the exception of: - Fixing a corner case when dumping with no dump providers registered (See changes in the unittest). - Making the fail-safe logic more strict: if a dumper fails once, it will stay disabled forever. BUG=461788 Committed: https://crrev.com/9734733909e7cb41ef5c153f3c2d0927e8209133 Cr-Commit-Position: refs/heads/master@{#366374}

Patch Set 1 #

Patch Set 2 : #

Total comments: 18

Patch Set 3 : ignore_Result #

Total comments: 8

Patch Set 4 : before lock removal #

Patch Set 5 : final without lock #

Total comments: 8

Patch Set 6 : more simplicity #

Total comments: 6

Patch Set 7 : comments #

Patch Set 8 : fix on double registration #

Patch Set 9 : remove DCHECK #

Unified diffs Side-by-side diffs Delta from patch set Stats (+226 lines, -188 lines) Patch
M base/trace_event/memory_dump_manager.h View 1 2 3 4 5 6 6 chunks +47 lines, -28 lines 0 comments Download
M base/trace_event/memory_dump_manager.cc View 1 2 3 4 5 6 7 8 9 chunks +110 lines, -144 lines 0 comments Download
M base/trace_event/memory_dump_manager_unittest.cc View 1 2 3 4 6 chunks +69 lines, -16 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 33 (15 generated)
Primiano Tucci (use gerrit)
Ok, lemme try again. This does not solve the UnregisterAsync problem, just makes the situation ...
5 years ago (2015-12-17 17:00:11 UTC) #2
Ruud van Asseldonk
Awesome, this looks much more elegant than before. I have few minor comments. https://codereview.chromium.org/1536533004/diff/20001/base/trace_event/memory_dump_manager.cc File ...
5 years ago (2015-12-17 20:20:39 UTC) #3
ssid
few thoughts. https://codereview.chromium.org/1536533004/diff/40001/base/trace_event/memory_dump_manager.cc File base/trace_event/memory_dump_manager.cc (right): https://codereview.chromium.org/1536533004/diff/40001/base/trace_event/memory_dump_manager.cc#newcode339 base/trace_event/memory_dump_manager.cc:339: // Unfortunatelly, in fact, PostTask() destroyes the ...
5 years ago (2015-12-17 22:09:36 UTC) #4
Primiano Tucci (use gerrit)
Thanks a lot guys, super useful feedback. I simplified even further and removed the lock ...
5 years ago (2015-12-18 12:00:31 UTC) #5
Ruud van Asseldonk
Threading is hard ... https://codereview.chromium.org/1536533004/diff/20001/base/trace_event/memory_dump_manager.cc File base/trace_event/memory_dump_manager.cc (right): https://codereview.chromium.org/1536533004/diff/20001/base/trace_event/memory_dump_manager.cc#newcode420 base/trace_event/memory_dump_manager.cc:420: pmd_async_state->pending_dump_providers.pop_front(); On 2015/12/18 12:00:31, Primiano ...
5 years ago (2015-12-18 12:40:43 UTC) #6
Primiano Tucci (use gerrit)
https://codereview.chromium.org/1536533004/diff/80001/base/trace_event/memory_dump_manager.cc File base/trace_event/memory_dump_manager.cc (right): https://codereview.chromium.org/1536533004/diff/80001/base/trace_event/memory_dump_manager.cc#newcode376 base/trace_event/memory_dump_manager.cc:376: mdpinfo->disabled = true; On 2015/12/18 12:40:43, Ruud van Asseldonk ...
5 years ago (2015-12-18 14:02:11 UTC) #8
ssid
lgtm thanks. https://codereview.chromium.org/1536533004/diff/100001/base/trace_event/memory_dump_manager.cc File base/trace_event/memory_dump_manager.cc (right): https://codereview.chromium.org/1536533004/diff/100001/base/trace_event/memory_dump_manager.cc#newcode377 base/trace_event/memory_dump_manager.cc:377: // We are now on the right ...
5 years ago (2015-12-18 15:16:53 UTC) #9
ssid
sorry, one more thought. https://codereview.chromium.org/1536533004/diff/100001/base/trace_event/memory_dump_manager.h File base/trace_event/memory_dump_manager.h (right): https://codereview.chromium.org/1536533004/diff/100001/base/trace_event/memory_dump_manager.h#newcode146 base/trace_event/memory_dump_manager.h:146: // the copy inside ProcessMemoryDumpAsyncState ...
5 years ago (2015-12-18 15:18:46 UTC) #10
Primiano Tucci (use gerrit)
https://codereview.chromium.org/1536533004/diff/100001/base/trace_event/memory_dump_manager.cc File base/trace_event/memory_dump_manager.cc (right): https://codereview.chromium.org/1536533004/diff/100001/base/trace_event/memory_dump_manager.cc#newcode377 base/trace_event/memory_dump_manager.cc:377: // We are now on the right thread to ...
5 years ago (2015-12-18 16:54:46 UTC) #11
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1536533004/120001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1536533004/120001
5 years ago (2015-12-18 16:55:10 UTC) #14
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1536533004/140001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1536533004/140001
5 years ago (2015-12-18 17:25:21 UTC) #18
commit-bot: I haz the power
Try jobs failed on following builders: cast_shell_linux on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/cast_shell_linux/builds/95113)
5 years ago (2015-12-18 17:57:35 UTC) #20
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1536533004/140001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1536533004/140001
5 years ago (2015-12-21 11:57:45 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1536533004/160001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1536533004/160001
5 years ago (2015-12-21 12:03:43 UTC) #27
commit-bot: I haz the power
Committed patchset #9 (id:160001)
5 years ago (2015-12-21 14:09:48 UTC) #29
commit-bot: I haz the power
Patchset 9 (id:??) landed as https://crrev.com/9734733909e7cb41ef5c153f3c2d0927e8209133 Cr-Commit-Position: refs/heads/master@{#366374}
5 years ago (2015-12-21 14:10:48 UTC) #31
Primiano Tucci (use gerrit)
A revert of this CL (patchset #9 id:160001) has been created in https://codereview.chromium.org/1540283003/ by primiano@chromium.org. ...
5 years ago (2015-12-21 15:23:30 UTC) #32
Primiano Tucci (use gerrit)
5 years ago (2015-12-22 10:34:18 UTC) #33
Message was sent while issue was closed.
On 2015/12/21 15:23:30, Primiano Tucci wrote:
> A revert of this CL (patchset #9 id:160001) has been created in
> https://codereview.chromium.org/1540283003/ by mailto:primiano@chromium.org.
> 
> The reason for reverting is: Caused crash in
> pending-version-change-stuck-works-with-terminate.html layout test.
> 
> See:
>
https://build.chromium.org/p/chromium.webkit/builders/WebKit%20Mac10.10/build...
> .

Relanding in crrev.com/1546583002
The race condition has been fixed by crrev.com/1544663002

Powered by Google App Engine
This is Rietveld 408576698