mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-23 03:48:13 +00:00
8282200: ShouldNotReachHere() reached by AsyncGetCallTrace after JDK-8280422
Reviewed-by: dholmes, mdoerr, kevinw
This commit is contained in:
parent
f4486a190e
commit
231e48fa63
@ -562,12 +562,11 @@ static void forte_fill_call_trace_given_top(JavaThread* thd,
|
||||
extern "C" {
|
||||
JNIEXPORT
|
||||
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()) {
|
||||
|
||||
(thread = JavaThread::thread_from_jni_environment(trace->env_id))->is_exiting()) {
|
||||
// bad env_id, thread has exited or thread is exiting
|
||||
trace->num_frames = ticks_thread_exit; // -8
|
||||
return;
|
||||
|
||||
@ -1323,14 +1323,15 @@ class JavaThread: public Thread {
|
||||
// external JNI entry points where the JNIEnv is passed into the VM.
|
||||
static JavaThread* thread_from_jni_environment(JNIEnv* env) {
|
||||
JavaThread* current = (JavaThread*)((intptr_t)env - in_bytes(jni_environment_offset()));
|
||||
// We can't get here in a thread that has completed its execution and so
|
||||
// "is_terminated", but a thread is also considered terminated if the VM
|
||||
// We can't normally get here in a thread that has completed its
|
||||
// execution and so "is_terminated", except when the call is from
|
||||
// AsyncGetCallTrace, which can be triggered by a signal at any point in
|
||||
// a thread's lifecycle. A thread is also considered terminated if the VM
|
||||
// has exited, so we have to check this and block in case this is a daemon
|
||||
// thread returning to the VM (the JNI DirectBuffer entry points rely on
|
||||
// this).
|
||||
if (current->is_terminated()) {
|
||||
current->block_if_vm_exited();
|
||||
ShouldNotReachHere();
|
||||
}
|
||||
return current;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user