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

How can openjdk1.8 use async-profile -e alloc without installing debug symbols #924

Closed
linliaoy opened this issue May 7, 2024 · 19 comments
Labels

Comments

@linliaoy
Copy link

linliaoy commented May 7, 2024

I use debug symbols in production environment, so I can't turn on debug symbols. I would like to ask if there is any good way. Can it be used perf-map-agent ?perf-map-agent also uses jvmti,Or is it possible to print all the mappings in the test environment 。jmap dump analysis file will have a good display, I don't know if it can be used for reference, I am still confused at present, want to achieve this condition

@apangin
Copy link
Collaborator

apangin commented May 7, 2024

Which JDK distribution do you use?
Many popular OpenJDK distributions do not require separate debug symbol package; they support allocation profiling out of the box:

@linliaoy
Copy link
Author

linliaoy commented May 8, 2024

Which JDK distribution do you use?
Many popular OpenJDK distributions do not require separate debug symbol package; they support allocation profiling out of the box:

openjdk version "1.8.0_171"
Is there a good way to do this without debugging symbols

@linliaoy
Copy link
Author

linliaoy commented May 8, 2024

VMObjectAlloc can_generate_vm_object_alloc_events Why can only isOpenJ9 be enabled?Is openjdk1.8 not possible?

@linliaoy
Copy link
Author

linliaoy commented May 8, 2024

See the code can get AsyncGetCallTrace symbolic address, I have an idea to get jni AllocObject function symbolic address to trace, or at this time all the symbolic address output

@apangin
Copy link
Collaborator

apangin commented May 9, 2024

Sorry, my question was about distribution (or vendor), not just about the version.
You can obtain it with java -XshowSettings:properties -version

As mentioned above, you can do allocation profiling on many OpenJDK 8 distributions without installing debug symbols. I don't think anything should be changed in this regard.

@linliaoy
Copy link
Author

linliaoy commented May 9, 2024

Which JDK distribution do you use? Many popular OpenJDK distributions do not require separate debug symbol package; they support allocation profiling out of the box:

The provided jdk contains debug symbols. Will it affect the performance and security of the production environment

@linliaoy
Copy link
Author

linliaoy commented May 9, 2024

Sorry, my question was about distribution (or vendor), not just about the version. You can obtain it with java -XshowSettings:properties -version

As mentioned above, you can do allocation profiling on many OpenJDK 8 distributions without installing debug symbols. I don't think anything should be changed in this regard.

java.vendor = Oracle Corporation
java.vendor.url = http://java.oracle.com/
java.version = 1.8.0_171

@linliaoy
Copy link
Author

linliaoy commented May 9, 2024

vmtrace
I found that you obtained symbols when you started the implementation based on jvmti. I don't know whether the symbols started by the same jdk in multiple Pods are the same. I remember that the linux kernel can be reused

@apangin
Copy link
Collaborator

apangin commented May 9, 2024

The provided jdk contains debug symbols. Will it affect the performance and security of the production environment

Symbol table is just a simple table that maps function names to addresses and vice versa. It has no impact on security or runtime performance.

java.vendor = Oracle Corporation
java.vendor.url = http://java.oracle.com/
java.version = 1.8.0_171

This JDK version is compiled with symbols included. You don't need to install anything additional - async-profiler should work fine with it out of the box.

BTW, if you are concerned about security, you should really consider updating your JDK.
JDK 1.8.0_171 has expired 6 years ago; it has a number of known vulnerabilities that have been fixed during these years.

@linliaoy
Copy link
Author

I reported an error when using
“./asprof -e alloc --alloc 500 -d 60 -f profile.html 1 ”
or
“./asprof -e alloc -d 60 -f profile.html 1”

error:
[WARN] Install JVM debug symbols to improve profile accuracy
[ERROR] No AllocTracer symbols found. Are JDK debug symbols installed?

@apangin
Copy link
Collaborator

apangin commented May 12, 2024

I verified that async-profiler 3.0 works fine with Oracle JDK 1.8.0_171.
So the problem must be somewhere else.

Please check the output of the following commands:

nm JAVA_HOME/jre/lib/amd64/server/libjvm.so | grep AllocTracer

and

grep asyncProfiler /proc/PID/maps

where JAVA_HOME is the JDK directory and PID is the process ID of the Java application.

@linliaoy
Copy link
Author

grep asyncProfiler /proc/PID/maps

7fbe63072000-7fbe630ba000 r-xp 00000000 fd:10 4457358 /async-profile/build/lib/libasyncProfiler.so
7fbe630ba000-7fbe632ba000 ---p 00048000 fd:10 4457358 /async-profile/build/lib/libasyncProfiler.so
7fbe632ba000-7fbe632bb000 r--p 00048000 fd:10 4457358 /async-profile/build/lib/libasyncProfiler.so
7fbe632bb000-7fbe632bc000 rw-p 00049000 fd:10 4457358 /async-profile/build/lib/libasyncProfiler.so

@linliaoy
Copy link
Author

linliaoy commented May 13, 2024

Thank you. I use the docker jdk openjdk:8u171-jdk-slim. When I install openjdk-8-dbg, I can do it, but this package is too big for the container, I may need to study adding openjdk-8-dbg when using, I do not know whether installation and uninstallation will affect the program running

@apangin
Copy link
Collaborator

apangin commented May 14, 2024

OK, it makes sense now. jdk-slim image indeed has symbols stripped.
I suggest simply to use a different image with one of JDKs listed above. All mentioned vendors provide container images.
Another important reason to change docker image is to get important security updates. 8u171 is way too old.

@linliaoy
Copy link
Author

attach and libasyncProfiler.so are not uninstalled after the -d time

@apangin
Copy link
Collaborator

apangin commented May 15, 2024

I'm not sure what you mean by "attach is not uninstalled".
As to libasyncProfiler.so - it's not unloaded from the target process. This is by design and should not cause any problems.

@linliaoy
Copy link
Author

When I am not using libasyncProfiler.so want to uninstall, is there a way

@apangin
Copy link
Collaborator

apangin commented May 16, 2024

There is no need to "uninstall" profiler. It does not affect application and and does not consume resources when profiling is not running. You may safely remove profiler binaries from disk if you wish, but once the library is loaded in a Java process, it stays there until the process terminates.

@linliaoy
Copy link
Author

Thank you. I'm closing this issue

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

No branches or pull requests

2 participants