lots of [unknown] show in the stack trace while using `tools/trace` to trace the method call in Java
- Dominant language
- C
- Stars
- 22.7k
- Forks
- 4.1k
- Avg merge
- 10d 4h
- Merged PRs (30d)
- 3
Description
Hi folks,
I am using BCC `tools/trace` to log the Java process whole method call graph during its running.
```shell
trace 'u:/usr/lib/jvm/java-11-openjdk-11.0.18.0.10-1.el7_9.x86_64/lib/server/libjvm.so:method__entry "%s",arg4' -U -K -p `pidof java`
```
After `tools/trace` runs I can see lots of stack trace being printed, But it contains too many [unknown] frames like that.
```text
20591 20592 java method__entry getEntry
-14
7f7b6bdc289d SharedRuntime::dtrace_method_entry(JavaThread*, Method*)+0x7d [libjvm.so]
7f7b4c810952 [unknown]
7f7b4c80bfc0 [unknown]
7f7b4c80bfc0 [unknown]
7f7b4c80bfc0 [unknown]
7f7b4c80bfc0 [unknown]
7f7b4c80c273 [unknown]
7f7b4c802cc9 [unknown]
7f7b6b976f35 JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x395 [libjvm.so]
7f7b6b9e5957 jni_invoke_nonstatic(JNIEnv_*, JavaValue*, _jobject*, JNICallType, _jmethodID*, JNI_ArgumentPusher*, Thread*) [clone .constprop.347]+0x2a7 [libjvm.so]
7f7b6b9f4123 jni_NewObject+0x1c3 [libjvm.so]
7f7b6a2570a3 newSizedStringJava+0x163 [libjava.so]
7f7b4c5fc0e8 NET_ThrowUnknownHostExceptionWithGaiError+0x78 [libnet.so]
7f7b4c5f1934 Java_java_net_Inet6AddressImpl_lookupAllHostAddr+0x294 [libnet.so]
7f7b4c811930 [unknown]
7f7b4c80c0a6 [unknown]
7f7b4c80c0a6 [unknown]
7f7b4c80bfc0 [unknown]
7f7b4c80c0a6 [unknown]
7f7b4c80bfc0 [unknown]
7f7b4c80bfc0 [unknown]
7f7b4c80bfc0 [unknown]
7f7b4c80bfc0 [unknown]
7f7b4c80c273 [unknown]
7f7b4c80bfc0 [unknown]
7f7b4c80c273 [unknown]
7f7b4c80c273 [unknown]
7f7b4c80c273 [unknown]
7f7b4c80bfc0 [unknown]
7f7b4c80bfc0 [unknown]
7f7b4c80bfc0 [unknown]
7f7b4c80c273 [unknown]
7f7b4c80c273 [unknown]
7f7b4c80c273 [unknown]
7f7b4c80bfc0 [unknown]
7f7b4c80bfc0 [unknown]
7f7b4c80bfc0 [unknown]
7f7b4c80c273 [unknown]
7f7b4c802cc9 [unknown]
7f7b6b976f35 JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x395 [libjvm.so]
7f7b6b9e3ddd jni_invoke_static(JNIEnv_*, JavaValue*, _jobject*, JNICallType, _jmethodID*, JNI_ArgumentPusher*, Thread*) [clone .isra.166]+0x22d [libjvm.so]
7f7b6b9ef3cd jni_CallStaticVoidMethod+0x17d [libjvm.so]
7f7b6cc283df JavaMain+0xa8f [libjli.so]
7f7b6cc2bf09 ThreadJavaMain+0x9 [libjli.so]
7f7b6ce3be25 start_thread+0xc5 [libpthread-2.17.so]
```
I would like to know why? I am curious that those stack traces were not included any Java basic library method calling information.
How can I solve it?
Basic Information:
- OS/Kernel Version
```shell
[root@192 vagrant]# uname -r
5.2.14-1.el7.elrepo.x86_64
```
- Java JDK Version
```shell
[root@192 vagrant]# java -version
openjdk version "11.0.18" 2023-01-17 LTS
OpenJDK Runtime Environment (Red_Hat-11.0.18.0.10-1.el7_9) (build 11.0.18+10-LTS)
OpenJDK 64-Bit Server VM (Red_Hat-11.0.18.0.10-1.el7_9) (build 11.0.18+10-LTS, mixed mode, sharing)
```
- Run Java program command
```shell
java -XX:+PreserveFramePointer -XX:+ExtendedDTraceProbes -jar httpdemo.jar
```
Thanks.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the report with BCC's tools/trace command against the supplied Java 11 setup, kernel version, and JVM flags. Inspect how the trace output resolves frames from libjvm.so and determine why the shown Java call information is absent. Done means documenting the cause and a verified way to avoid or explain the [unknown] frames.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, linux
- Domain
- devtools, observability-sre
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100