-
Bug
-
Resolution: Fixed
-
P4
-
19
-
b12
The observation of JDK-8280422 does not hold true for AsyncGetCallTrace.
The enhancementJDK-8280422 assumes that "thread_from_jni_environment can never return NULL", this is not true when taking AsyncGetCallTrace into consideration.
Profiling a debug build of the JDK running the dacapo benchmark tomcat with async-profiler, results in the following error (from the generated hs_err file):
```
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (../../src/hotspot/share/runtime/thread.hpp:1327), pid=1320, tid=36355
# Error: ShouldNotReachHere()
```
This is related to the beginning of AsyncGetCallTrace:
```
void AsyncGetCallTrace(ASGCT_CallTrace *trace, jint depth, void* ucontext) {
JavaThread* thread;
if (trace->env_id == NULL ||
(thread = JavaThread::thread_from_jni_environment(trace->env_id)) == NULL ||
thread->is_exiting()) {
// bad env_id, thread has exited or thread is exiting
trace->num_frames = ticks_thread_exit; // -8
return;
}
```
Before the PR https://git.openjdk.java.net/jdk/pull/7193 related to the mentioned enhancement, this check was possible, but with the change the JVM aborts in the `thread_from_jni_environment` when `is_exiting()` is true. Therefore this check is superflous. See discussion in this PR. Please comment there as Johannes Bechberger cannot do it in JBS, yet.
The enhancement
Profiling a debug build of the JDK running the dacapo benchmark tomcat with async-profiler, results in the following error (from the generated hs_err file):
```
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (../../src/hotspot/share/runtime/thread.hpp:1327), pid=1320, tid=36355
# Error: ShouldNotReachHere()
```
This is related to the beginning of AsyncGetCallTrace:
```
void AsyncGetCallTrace(ASGCT_CallTrace *trace, jint depth, void* ucontext) {
JavaThread* thread;
if (trace->env_id == NULL ||
(thread = JavaThread::thread_from_jni_environment(trace->env_id)) == NULL ||
thread->is_exiting()) {
// bad env_id, thread has exited or thread is exiting
trace->num_frames = ticks_thread_exit; // -8
return;
}
```
Before the PR https://git.openjdk.java.net/jdk/pull/7193 related to the mentioned enhancement, this check was possible, but with the change the JVM aborts in the `thread_from_jni_environment` when `is_exiting()` is true. Therefore this check is superflous. See discussion in this PR. Please comment there as Johannes Bechberger cannot do it in JBS, yet.
- relates to
-
JDK-8280422 thread_from_jni_environment can never return NULL
- Resolved