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

Issue 677302 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: May 2017
Cc:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 3
Type: Bug

Blocked on:
issue 693237
issue 665567



Sign in to add a comment

Make native heap profiling work on macOS.

Project Member Reported by erikc...@chromium.org, Dec 28 2016

Issue description

https://chromium.googlesource.com/chromium/src/+/master/docs/memory-infra/heap_profiler.md

When the allocator shim is hooked up: https://codereview.chromium.org/2601573002/, macOS Chrome seems to have no trouble emitted a native heap profiling trace. 
[build with debug=true, symbol_level=1, enable_profiling=true, launch with: --enable-heap-profiling=native].

There are two issues that we need to fix:
1) Symbolication. [e.g. third_party/catapult/tracing/bin/symbolize_trace]

2) Getting the heap details tree to show up on macOS. When I load the same trace [emitted from macOS] on Linux, everything works as expected [with un-symbolized PCs], but when I load the trace on macOS, there is no right-arrow to expand malloc. See screenshots and attached trace.
 
trace_test11.json.gz
519 KB Download
Screen Shot 2016-12-28 at 10.46.04 AM.png
539 KB View Download
Screen Shot 2016-12-28 at 10.46.10 AM.png
247 KB View Download
3) We need to dump the image load locations on macOS, see components/tracing/common/process_metrics_memory_dump_provider.cc.
I've got a proof of concept working for (1) and (3). Will upload some CLs.
Owner: erikc...@chromium.org
Status: Assigned (was: Untriaged)
Cc: dskiba@chromium.org
Project Member

Comment 6 by bugdroid1@chromium.org, Feb 10 2017

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

commit bf11b55a9f6874eed37da83fe741494e39e4b3b9
Author: erikchen <erikchen@chromium.org>
Date: Fri Feb 10 01:34:48 2017

mac: Hook up allocator shim during app startup and for tests.

This CL has no intended functional change.

The flag to flip the allocator shim to "true" will be set in another CL. This
plumbing is being landed separately, since flipping the flag is expected to be
disruptive and will likely need to go through several land/revert cycles.

BUG= 677302 

Review-Url: https://codereview.chromium.org/2676093003
Cr-Commit-Position: refs/heads/master@{#449508}

[modify] https://crrev.com/bf11b55a9f6874eed37da83fe741494e39e4b3b9/base/allocator/allocator_check.cc
[modify] https://crrev.com/bf11b55a9f6874eed37da83fe741494e39e4b3b9/base/allocator/allocator_interception_mac.h
[modify] https://crrev.com/bf11b55a9f6874eed37da83fe741494e39e4b3b9/base/allocator/allocator_interception_mac.mm
[modify] https://crrev.com/bf11b55a9f6874eed37da83fe741494e39e4b3b9/base/process/memory_mac.mm
[modify] https://crrev.com/bf11b55a9f6874eed37da83fe741494e39e4b3b9/base/process/memory_unittest.cc
[modify] https://crrev.com/bf11b55a9f6874eed37da83fe741494e39e4b3b9/content/app/content_main_runner.cc

Blockedon: 665567
Project Member

Comment 8 by bugdroid1@chromium.org, Feb 13 2017

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

commit a232b05bbe4456d3e7ac38074a48a35488ea6f8b
Author: erikchen <erikchen@chromium.org>
Date: Mon Feb 13 22:16:06 2017

mac: Emit dyld info from the memory dump provider.

Both task_info(TASK_DYLD_INFO) and mach_vm_region_recurse() provide information
about the memory regions in the process. There is some duplicate information.
This CL updates DumpProcessMemoryMaps() to use both methods, and merges the
information from the two functions.

This CL also avoids emitting byte stats for regions in the dyld shared cache,
since it's not possible to assign byte stats to specific regions, and the
regions are likely in use by non-Chrome processes anyways.

BUG= 677302 

Review-Url: https://codereview.chromium.org/2674973004
Cr-Commit-Position: refs/heads/master@{#450113}

[modify] https://crrev.com/a232b05bbe4456d3e7ac38074a48a35488ea6f8b/components/tracing/common/process_metrics_memory_dump_provider.cc
[modify] https://crrev.com/a232b05bbe4456d3e7ac38074a48a35488ea6f8b/components/tracing/common/process_metrics_memory_dump_provider_unittest.cc

Project Member

Comment 9 by bugdroid1@chromium.org, Feb 14 2017

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

commit ab510e5f21028950cec63965e024a40bd1ccba66
Author: erikchen <erikchen@chromium.org>
Date: Tue Feb 14 09:24:08 2017

mac: Turn on allocator shim.

Prior to this CL, all Malloc Zone functions were rerouted through a light-weight
shim that kills the process [in oom_killer_malloc] on failure. This CL instead
reroutes the functions to the allocator shim, which is cross-platform, and has
the same effect on failure. The allocator shim also provides the ability to
track all allocations.

BUG= 677302 

Review-Url: https://codereview.chromium.org/2673173002
Cr-Commit-Position: refs/heads/master@{#450302}

[modify] https://crrev.com/ab510e5f21028950cec63965e024a40bd1ccba66/build/config/allocator.gni

Project Member

Comment 10 by bugdroid1@chromium.org, Feb 15 2017

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

commit f01f0b358c7733ee91e7c017430300786a47f043
Author: catapult-deps-roller <catapult-deps-roller@chromium.org>
Date: Wed Feb 15 06:30:48 2017

Roll src/third_party/catapult/ 7336c9424..d31d89623 (1 commit).

https://chromium.googlesource.com/external/github.com/catapult-project/catapult.git/+log/7336c9424b01..d31d896231ad

$ git log 7336c9424..d31d89623 --date=short --no-merges --format='%ad %ae %s'
2017-02-14 erikchen Update symbolize_trace to work on macOS.

Created with:
  roll-dep src/third_party/catapult
BUG= 677302 

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+/master/autoroll/README.md

If the roll is causing failures, see:
http://www.chromium.org/developers/tree-sheriffs/sheriff-details-chromium#TOC-Failures-due-to-DEPS-rolls

CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.android:android_optional_gpu_tests_rel
TBR=catapult-sheriff@chromium.org

Review-Url: https://codereview.chromium.org/2696113002
Cr-Commit-Position: refs/heads/master@{#450595}

[modify] https://crrev.com/f01f0b358c7733ee91e7c017430300786a47f043/DEPS

Project Member

Comment 11 by bugdroid1@chromium.org, Feb 15 2017

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

commit 99b21cc6a775c54d8df60f785356da3b21f054e2
Author: erikchen <erikchen@chromium.org>
Date: Wed Feb 15 19:11:07 2017

Update logic for emitting region information from dyld.

1. Use the slide to compute the segment load addresses.
2. Update the logic for combining regions from dyld and mach_vm_region_recurse.
  2a. Allow a vm region to be fully contained with a dyld region.
  2b. Skip vm regions that intersect dyld regions in the dyld shared cache.

BUG= 677302 

Review-Url: https://codereview.chromium.org/2696923002
Cr-Commit-Position: refs/heads/master@{#450757}

[modify] https://crrev.com/99b21cc6a775c54d8df60f785356da3b21f054e2/components/tracing/common/process_metrics_memory_dump_provider.cc
[modify] https://crrev.com/99b21cc6a775c54d8df60f785356da3b21f054e2/components/tracing/common/process_metrics_memory_dump_provider.h
[modify] https://crrev.com/99b21cc6a775c54d8df60f785356da3b21f054e2/components/tracing/common/process_metrics_memory_dump_provider_unittest.cc

Blockedon: 693237
Project Member

Comment 13 by bugdroid1@chromium.org, Feb 17 2017

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

commit f51b7d1a5db6ae289736b84622494086c54cd49a
Author: erikchen <erikchen@chromium.org>
Date: Fri Feb 17 19:47:48 2017

Fix stack walking to notice if the frame is obviously not valid.

If the PC is too small, the frame can't be valid.

BUG= 677302 

Review-Url: https://codereview.chromium.org/2692123005
Cr-Commit-Position: refs/heads/master@{#451355}

[modify] https://crrev.com/f51b7d1a5db6ae289736b84622494086c54cd49a/base/debug/stack_trace.cc

BTW on macOS library function backtrace() unwinds using stack pointers: https://opensource.apple.com/source/Libc/Libc-825.24/gen/thread_stack_pcs.c

And it correctly takes into accounts thread boundaries.

So to get correct unwinding we need to either implement GetStackEnd() in terms of pthread_get_stackaddr_np / pthread_get_stacksize_np, or use backtrace() instead of (or as an implementation detail) TraceStackFramePointers.

I would prefer we implemented GetStackEnd() though.
Project Member

Comment 15 by bugdroid1@chromium.org, Feb 19 2017

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

commit e86fbe70bbe580990957eca6a00531bd421358c9
Author: catapult-deps-roller <catapult-deps-roller@chromium.org>
Date: Sun Feb 19 03:45:52 2017

Roll src/third_party/catapult/ 36a508280..84a7af661 (27 commits).

https://chromium.googlesource.com/external/github.com/catapult-project/catapult.git/+log/36a50828018d..84a7af661032

$ git log 36a508280..84a7af661 --date=short --no-merges --format='%ad %ae %s'
2017-02-17 dtu Use third-party libraries in Catapult instead of the App Engine SDK.
2017-02-17 jessimb Adjusting css to make group by counter work for 3 numbers.
2017-02-17 jessimb Allow a user to enter a milestone param to view the table.
2017-02-17 jessimb Added new index for Anomaly.
2017-02-17 nednguyen Revert of [Telemetry] Migrate browser_test_runner to use typ as the test runner (patchset #1 id:1 of https://codereview.chromium.org/2700563004/ )
2017-02-17 sullivan First version of benchmark health report.
2017-02-17 benjhayden Remove storyRepeatCounter.
2017-02-17 benjhayden Merge RelatedHistogram diagnostics.
2017-02-17 mikecase Fix for improper call to ps on Android versions greater than N.
2017-02-17 ulan Make estimatedInputLatency metric more friendly for traces without TTI.
2017-02-17 erikchen Use absolute pcs and load locations to symbolize on macOS.
2017-02-17 erikchen Fix a bug introduced in a refactor to the ELFSymbolizer.
2017-02-17 nednguyen [Telemetry] Remove --page-repeat flag
2017-02-17 hjd [dashboard] Avoid double XHR in /report
2017-02-16 dtu [pinpoint] Add Job.job_id property.
2017-02-16 nednguyen Roll typ v0.9.5 -> v0.9.11 (a277897604718c..f6afa2bbd1765b21e8)
2017-02-16 eakuefner [Dashboard] Only validate row_id for first row in add_point
2017-02-16 eakuefner [Dashboard] Use list_tests.GetTestsForTestPathDict in /graph_json
2017-02-16 eakuefner [Dashboard] Add test for listing tests with empty selection in test_path_dict
2017-02-16 benjhayden Fix merging Diagnostics.
2017-02-16 benjhayden Add CollectedRelatedEventSet diagnostic.
2017-02-16 eakuefner [Dashboard] Add capability for querying unselected tests by test_path_dict
2017-02-16 nednguyen [Telemetry] Migrate browser_test_runner to use typ as the test runner
2017-02-16 eakuefner [Dashboard] Add 'test_path_dict' request type to /list_tests
2017-02-16 benjhayden Replace values with histograms in metric_map_function.
2017-02-16 rnephew [WPR] Add log message when downloading archives.
2017-02-16 alexandermont Separate "time interval" from "metric collection" logic in power_metrics.html.

Created with:
  roll-dep src/third_party/catapult
BUG= 636153 ,625701, 677302 , 677302 , 689788 , 636153 

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+/master/autoroll/README.md

If the roll is causing failures, see:
http://www.chromium.org/developers/tree-sheriffs/sheriff-details-chromium#TOC-Failures-due-to-DEPS-rolls

CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.android:android_optional_gpu_tests_rel
TBR=catapult-sheriff@chromium.org

Review-Url: https://codereview.chromium.org/2705883002
Cr-Commit-Position: refs/heads/master@{#451509}

[modify] https://crrev.com/e86fbe70bbe580990957eca6a00531bd421358c9/DEPS

Comment 16 by vabr@chromium.org, Feb 20 2017

This likely caused a consistent breakage on CrOS ASAN/LSAN bot:
https://build.chromium.org/p/chromium.memory/builders/Linux%20Chromium%20OS%20ASan%20LSan%20Tests%20%281%29

All the browser_tests are failing with
==9044==ERROR: AddressSanitizer: stack-overflow on address 0x7fffad462008 (pc 0x00000ab9bbe1 bp 0x7fffad45b3f0 sp 0x7fffad45b3d0 T0)
    #0 0xab9bbe0 in GetStackFramePC base/debug/stack_trace.cc:100:10
    #1 0xab9bbe0 in IsStackFrameValid base/debug/stack_trace.cc:116
    #2 0xab9bbe0 in ScanStackForNextFrame base/debug/stack_trace.cc:172
    #3 0xab9bbe0 in base::debug::TraceStackFramePointers(void const**, unsigned long, unsigned long) base/debug/stack_trace.cc:248
    #4 0x635a2f6 in CloseOverride chrome/browser/chromeos/libc_close_tracking.cc:127:9
    #5 0x7f43b78f302f in FcConfigParseAndLoad (/usr/lib/x86_64-linux-gnu/libfontconfig.so.1+0x2102f)


Full stdio attached.

First failing build was https://build.chromium.org/p/chromium.memory/builders/Linux%20Chromium%20OS%20ASan%20LSan%20Tests%20%281%29/builds/19604.
Log File contents.zip
4.5 MB Download

Comment 17 by vabr@chromium.org, Feb 20 2017

Revert in progress: https://codereview.chromium.org/2704933004/

Comment 18 by vabr@chromium.org, Feb 20 2017

The revert is consistently putting the android_n5x_swarming_rel bot into an exception state, so I won't land it. However, the breakage on https://build.chromium.org/p/chromium.memory/builders/Linux%20Chromium%20OS%20ASan%20LSan%20Tests%20%281%29 continues. Please do have a look into that.
Project Member

Comment 19 by bugdroid1@chromium.org, Feb 21 2017

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

commit 27f8b7ea6bbee0b512ce820842ebe8bba019b050
Author: vabr <vabr@chromium.org>
Date: Tue Feb 21 16:28:49 2017

Revert of Fix stack walking to notice if the frame is obviously not valid. (patchset #2 id:20001 of https://codereview.chromium.org/2692123005/ )

Reason for revert:
This likely caused a consistent breakage on CrOS ASAN/LSAN bot: https://build.chromium.org/p/chromium.memory/builders/Linux%20Chromium%20OS%20ASan%20LSan%20Tests%20%281%29/builds/19604

More info on  https://crbug.com/677302#c16 

Original issue's description:
> Fix stack walking to notice if the frame is obviously not valid.
>
> If the PC is too small, the frame can't be valid.
>
> BUG= 677302 
>
> Review-Url: https://codereview.chromium.org/2692123005
> Cr-Commit-Position: refs/heads/master@{#451355}
> Committed: https://chromium.googlesource.com/chromium/src/+/f51b7d1a5db6ae289736b84622494086c54cd49a

TBR=mark@chromium.org,wez@chromium.org,erikchen@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG= 677302 

Review-Url: https://codereview.chromium.org/2704933004
Cr-Commit-Position: refs/heads/master@{#451774}

[modify] https://crrev.com/27f8b7ea6bbee0b512ce820842ebe8bba019b050/base/debug/stack_trace.cc

Going to try to reland the CL that was reverted in c#19. Changing the ordering of two conditionals, which should keep the original behavior on Linux.
I think the better path is to implement GetStackEnd() - in that case we'll be 100% sure our reads are within the stack.
Project Member

Comment 22 by bugdroid1@chromium.org, Feb 22 2017

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

commit d6b2b82cca164cd88ce9f212d4562c01d286973d
Author: erikchen <erikchen@chromium.org>
Date: Wed Feb 22 21:10:31 2017

mac: Implement GetStackEnd().

This allows IsStackFrameValid() to correctly use GetStackFramePC() to determine
if a frame has fallen off the end of the stack.

BUG= 677302 

Review-Url: https://codereview.chromium.org/2707973004
Cr-Commit-Position: refs/heads/master@{#452200}

[modify] https://crrev.com/d6b2b82cca164cd88ce9f212d4562c01d286973d/base/debug/stack_trace.cc
[modify] https://crrev.com/d6b2b82cca164cd88ce9f212d4562c01d286973d/base/debug/stack_trace.h
[modify] https://crrev.com/d6b2b82cca164cd88ce9f212d4562c01d286973d/base/debug/stack_trace_unittest.cc

Status: Fixed (was: Assigned)

Sign in to add a comment