Skip to content
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

Java off heap allocation profiling (with mprotect event) issue #814

Closed
RoySunnySean007 opened this issue Sep 12, 2023 · 5 comments
Closed

Comments

@RoySunnySean007
Copy link
Contributor

RoySunnySean007 commented Sep 12, 2023

Dear experts,

According to https://youtu.be/c755fFv1Rnk, I use profiler.sh -d <duration> -e mprotect -f <absolute path of html file> <java pid> to profile java off-heap object allocation, but interestingly, there are ~50% samples just show mprotect.
My JDK is JDK11, async version is 2.9, and I run java application in container, and set kernel.perf_event_paranoid=1 and kernel.kptr_restrict=0 in the host machine.
Could u please kindly let me know if there is any wrong? Thanks in advance!

sh-4.2# ./profiler.sh -v
Async-profiler 2.9 built on Nov 26 2022
Copyright 2016-2021 Andrei Pangin
sh-4.2# ./profiler.sh -d 60 -e mprotect -f /tmp/sample.html 1 
Profiling for 60 seconds
sh-4.2# java -version
openjdk version "11.0.10" 2021-01-19 LTS
OpenJDK Runtime Environment Corretto-11.0.10.9.1 (build 11.0.10+9-LTS)
OpenJDK 64-Bit Server VM Corretto-11.0.10.9.1 (build 11.0.10+9-LTS, mixed mode)
sh-4.2# 
image
@apangin
Copy link
Collaborator

apangin commented Sep 12, 2023

The default stack walking algorithm cannot get a stack trace of mprotect, because the system library is apparently compiled with omit-frame-pointer optimization.

Try --cstack dwarf option - this should help to recover correct stack traces for mprotect.

@RoySunnySean007
Copy link
Contributor Author

It works, turned out to be GC related. Thanks @apangin !

@RoySunnySean007
Copy link
Contributor Author

RoySunnySean007 commented Sep 13, 2023

Dear @apangin , sorry to interrupt you again...

My previous assumption is GC related, am I right? If possible, could u please kindly let me know how can I correlate these native async profiler samples to specific functions? Thanks in advance!

There are two parts: deoptimization & _GI_Clone

image image

@apangin
Copy link
Collaborator

apangin commented Sep 13, 2023

I'm not sure I understand. Neither of these stack traces come from GC.

This SO answer explains how to find cause of deoptimization. In any case, I don't think deoptimization relates to off-heap memory leak. From your profile, netty buffers are more likely suspect.

@RoySunnySean007
Copy link
Contributor Author

Thanks @apangin for ur clear explanation with SO answer!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants