Add method for recording the last N PostTasks to create a "virtual" backtrace of async actions. |
|
Issue descriptionChromium code uses PostTask a lot to do a poorman's version of continuation passing style. Thus, a "backtrace" is often incomplete because it terminates at the most recently executed task. The FROM_HERE/posted_from token helps give 1 frame of context, but what's often wanted is a short record of all the various asynchronous posts. This can fairly easily be implemented by adding a short array of program_counters providing a breadcrumb (or async backtrace) of posted_from records. This array can then be copied onto the stack during a task execution and aliased to ensure the compiler does not optimize it out. Because it is on the stack, it will be captured in crash dumps. There will need to be tooling in the crash processing system to recognize and symbolize this object, but at least the data will be there. The performance impact of this will be the equivalent of a 4 word copy per post-task. Almost certainly eaten by the pipeline.
,
Feb 9 2017
note: when current_pending_task is hosited out of MessageLooop, remember to undo the friend for the PendingTaskTest from MessageLoop and to stuff PendingTaskTest into an anonymous namespace.
,
Feb 9 2017
Investigate if there's a good way to handle alignment + sizing of the backtrace to ensure vectorized std::copy...
,
Feb 9 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/4f13f74b94d6f0a39b73a832217c5ccc2f02e60f commit 4f13f74b94d6f0a39b73a832217c5ccc2f02e60f Author: ajwong <ajwong@chromium.org> Date: Thu Feb 09 23:52:40 2017 Record async "task backtraces" Places a small array in PendingTask that records the past 4 PostTasks that result in this task being run. In essence, it creates a backtrace of the asynchronous call stack resulting in this task being run. This array is copied onto the stack during execution so that it is available in crash dumps. BUG=690197 Review-Url: https://codereview.chromium.org/1044413002 Cr-Commit-Position: refs/heads/master@{#449471} [modify] https://crrev.com/4f13f74b94d6f0a39b73a832217c5ccc2f02e60f/base/BUILD.gn [modify] https://crrev.com/4f13f74b94d6f0a39b73a832217c5ccc2f02e60f/base/debug/task_annotator.cc [modify] https://crrev.com/4f13f74b94d6f0a39b73a832217c5ccc2f02e60f/base/message_loop/incoming_task_queue.cc [modify] https://crrev.com/4f13f74b94d6f0a39b73a832217c5ccc2f02e60f/base/message_loop/message_loop.cc [modify] https://crrev.com/4f13f74b94d6f0a39b73a832217c5ccc2f02e60f/base/message_loop/message_loop.h [modify] https://crrev.com/4f13f74b94d6f0a39b73a832217c5ccc2f02e60f/base/pending_task.cc [modify] https://crrev.com/4f13f74b94d6f0a39b73a832217c5ccc2f02e60f/base/pending_task.h [add] https://crrev.com/4f13f74b94d6f0a39b73a832217c5ccc2f02e60f/base/pending_task_unittest.cc |
|
►
Sign in to add a comment |
|
Comment 1 by ajwong@chromium.org
, Feb 8 2017