-
Notifications
You must be signed in to change notification settings - Fork 937
Correctly unwind the stack for malloc events in VM stack walking mode #1357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correctly unwind the stack for malloc events in VM stack walking mode #1357
Conversation
src/profiler.cpp
Outdated
num_frames += StackWalker::walkVM(ucontext, frames + num_frames, _max_stack_depth, VM_NORMAL); | ||
} else { | ||
num_frames += getJavaTraceAsync(ucontext, frames + num_frames, _max_stack_depth, &java_ctx); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unwinding logic here is similar to unwinding stacktraces of regular CPU samples, so can we merge it with the above branch (event_type <= WALL_CLOCK_SAMPLE)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's possible but should I keep the inner if check for CPU samples only?
java_frames > 0 && java_ctx.pc != NULL && VMStructs::hasMethodStructs()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as discussed offline updated here 48268c4
Disable JFR OldObjectSample event in jfrsync mode (async-profiler#1350) Fix invalid alignment in mallocTracer and zero-init buf in getTotalCpuTime (async-profiler#1351) C++ linting via clang-tidy (async-profiler#1338) Allow cstack=vmx for native applications (async-profiler#1354) Correctly unwind stack for malloc events in VM stack walking mode (async-profiler#1357) Simplify location handling in OTLP (async-profiler#1361) Suppress javac warnings when compiling tests Do not include excess files in test.jar Fix nonjava test failure on Alpine Auto-generated clang-tidy review comments (async-profiler#1360) JFR to OTLP converter (async-profiler#1336) Cancel redundant in-progress GHA runs (async-profiler#1363) Ensure that only files under `src/` are checked in `cpp-lint-diff` (async-profiler#1365) Publish clang-tidy comments only for non-draft PRs (async-profiler#1367) Give tests unique suffix names (async-profiler#1371) Test OTLP output format (async-profiler#1331) Disable JFR OldObjectSample event in jfrsync mode (async-profiler#1350) Fix invalid alignment in mallocTracer and zero-init buf in getTotalCpuTime (async-profiler#1351) C++ linting via clang-tidy (async-profiler#1338) Allow cstack=vmx for native applications (async-profiler#1354) Correctly unwind stack for malloc events in VM stack walking mode (async-profiler#1357) Simplify location handling in OTLP (async-profiler#1361) Suppress javac warnings when compiling tests Do not include excess files in test.jar Fix nonjava test failure on Alpine Auto-generated clang-tidy review comments (async-profiler#1360) JFR to OTLP converter (async-profiler#1336) Cancel redundant in-progress GHA runs (async-profiler#1363) Ensure that only files under `src/` are checked in `cpp-lint-diff` (async-profiler#1365) Publish clang-tidy comments only for non-draft PRs (async-profiler#1367) Give tests unique suffix names (async-profiler#1371) Test OTLP output format (async-profiler#1331)
Disable JFR OldObjectSample event in jfrsync mode (async-profiler#1350) Fix invalid alignment in mallocTracer and zero-init buf in getTotalCpuTime (async-profiler#1351) C++ linting via clang-tidy (async-profiler#1338) Allow cstack=vmx for native applications (async-profiler#1354) Correctly unwind stack for malloc events in VM stack walking mode (async-profiler#1357) Simplify location handling in OTLP (async-profiler#1361) Suppress javac warnings when compiling tests Do not include excess files in test.jar Fix nonjava test failure on Alpine Auto-generated clang-tidy review comments (async-profiler#1360) JFR to OTLP converter (async-profiler#1336) Cancel redundant in-progress GHA runs (async-profiler#1363) Ensure that only files under `src/` are checked in `cpp-lint-diff` (async-profiler#1365) Publish clang-tidy comments only for non-draft PRs (async-profiler#1367) Give tests unique suffix names (async-profiler#1371) Test OTLP output format (async-profiler#1331) Disable JFR OldObjectSample event in jfrsync mode (async-profiler#1350) Fix invalid alignment in mallocTracer and zero-init buf in getTotalCpuTime (async-profiler#1351) C++ linting via clang-tidy (async-profiler#1338) Allow cstack=vmx for native applications (async-profiler#1354) Correctly unwind stack for malloc events in VM stack walking mode (async-profiler#1357) Simplify location handling in OTLP (async-profiler#1361) Suppress javac warnings when compiling tests Do not include excess files in test.jar Fix nonjava test failure on Alpine Auto-generated clang-tidy review comments (async-profiler#1360) JFR to OTLP converter (async-profiler#1336) Cancel redundant in-progress GHA runs (async-profiler#1363) Ensure that only files under `src/` are checked in `cpp-lint-diff` (async-profiler#1365) Publish clang-tidy comments only for non-draft PRs (async-profiler#1367) Give tests unique suffix names (async-profiler#1371) Test OTLP output format (async-profiler#1331)
Disable JFR OldObjectSample event in jfrsync mode (async-profiler#1350) Fix invalid alignment in mallocTracer and zero-init buf in getTotalCpuTime (async-profiler#1351) C++ linting via clang-tidy (async-profiler#1338) Allow cstack=vmx for native applications (async-profiler#1354) Correctly unwind stack for malloc events in VM stack walking mode (async-profiler#1357) Simplify location handling in OTLP (async-profiler#1361) Suppress javac warnings when compiling tests Do not include excess files in test.jar Fix nonjava test failure on Alpine Auto-generated clang-tidy review comments (async-profiler#1360) JFR to OTLP converter (async-profiler#1336) Cancel redundant in-progress GHA runs (async-profiler#1363) Ensure that only files under `src/` are checked in `cpp-lint-diff` (async-profiler#1365) Publish clang-tidy comments only for non-draft PRs (async-profiler#1367) Give tests unique suffix names (async-profiler#1371) Test OTLP output format (async-profiler#1331) Disable JFR OldObjectSample event in jfrsync mode (async-profiler#1350) Fix invalid alignment in mallocTracer and zero-init buf in getTotalCpuTime (async-profiler#1351) C++ linting via clang-tidy (async-profiler#1338) Allow cstack=vmx for native applications (async-profiler#1354) Correctly unwind stack for malloc events in VM stack walking mode (async-profiler#1357) Simplify location handling in OTLP (async-profiler#1361) Suppress javac warnings when compiling tests Do not include excess files in test.jar Fix nonjava test failure on Alpine Auto-generated clang-tidy review comments (async-profiler#1360) JFR to OTLP converter (async-profiler#1336) Cancel redundant in-progress GHA runs (async-profiler#1363) Ensure that only files under `src/` are checked in `cpp-lint-diff` (async-profiler#1365) Publish clang-tidy comments only for non-draft PRs (async-profiler#1367) Give tests unique suffix names (async-profiler#1371) Test OTLP output format (async-profiler#1331)
Disable JFR OldObjectSample event in jfrsync mode (async-profiler#1350) Fix invalid alignment in mallocTracer and zero-init buf in getTotalCpuTime (async-profiler#1351) C++ linting via clang-tidy (async-profiler#1338) Allow cstack=vmx for native applications (async-profiler#1354) Correctly unwind stack for malloc events in VM stack walking mode (async-profiler#1357) Simplify location handling in OTLP (async-profiler#1361) Suppress javac warnings when compiling tests Do not include excess files in test.jar Fix nonjava test failure on Alpine Auto-generated clang-tidy review comments (async-profiler#1360) JFR to OTLP converter (async-profiler#1336) Cancel redundant in-progress GHA runs (async-profiler#1363) Ensure that only files under `src/` are checked in `cpp-lint-diff` (async-profiler#1365) Publish clang-tidy comments only for non-draft PRs (async-profiler#1367) Give tests unique suffix names (async-profiler#1371) Test OTLP output format (async-profiler#1331) Disable JFR OldObjectSample event in jfrsync mode (async-profiler#1350) Fix invalid alignment in mallocTracer and zero-init buf in getTotalCpuTime (async-profiler#1351) C++ linting via clang-tidy (async-profiler#1338) Allow cstack=vmx for native applications (async-profiler#1354) Correctly unwind stack for malloc events in VM stack walking mode (async-profiler#1357) Simplify location handling in OTLP (async-profiler#1361) Suppress javac warnings when compiling tests Do not include excess files in test.jar Fix nonjava test failure on Alpine Auto-generated clang-tidy review comments (async-profiler#1360) JFR to OTLP converter (async-profiler#1336) Cancel redundant in-progress GHA runs (async-profiler#1363) Ensure that only files under `src/` are checked in `cpp-lint-diff` (async-profiler#1365) Publish clang-tidy comments only for non-draft PRs (async-profiler#1367) Give tests unique suffix names (async-profiler#1371) Test OTLP output format (async-profiler#1331)
Description
VM stack walker doesn't work on Malloc events which causes frames to not be unwound correctly
Related issues
N/A
Motivation and context
Fix VM stack walker on malloc to avoid bad samples
How has this been tested?
added a native memory test with VM stack walking => was failing before change & now passes
make test
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.