Mercurial > hg > graal-jvmci-8
comparison src/share/vm/prims/jvmtiEnvBase.cpp @ 8673:5ee250974db9
8007476: assert(the_owner != NULL) failed: Did not find owning Java thread for lock word address
Summary: Make deadlock detection a little more robust in the case of being unable to find the JavaThread associated with an object lock.
Reviewed-by: sla, acorn
author | dcubed |
---|---|
date | Wed, 27 Feb 2013 15:00:30 -0800 |
parents | 8b46b0196eb0 |
children | b9a918201d47 ce8f6bb717c9 |
comparison
equal
deleted
inserted
replaced
8671:698b615a1cde | 8673:5ee250974db9 |
---|---|
995 // This monitor is owned so we have to find the owning JavaThread. | 995 // This monitor is owned so we have to find the owning JavaThread. |
996 // Since owning_thread_from_monitor_owner() grabs a lock, GC can | 996 // Since owning_thread_from_monitor_owner() grabs a lock, GC can |
997 // move our object at this point. However, our owner value is safe | 997 // move our object at this point. However, our owner value is safe |
998 // since it is either the Lock word on a stack or a JavaThread *. | 998 // since it is either the Lock word on a stack or a JavaThread *. |
999 owning_thread = Threads::owning_thread_from_monitor_owner(owner, !at_safepoint); | 999 owning_thread = Threads::owning_thread_from_monitor_owner(owner, !at_safepoint); |
1000 assert(owning_thread != NULL, "sanity check"); | 1000 // Cannot assume (owning_thread != NULL) here because this function |
1001 if (owning_thread != NULL) { // robustness | 1001 // may not have been called at a safepoint and the owning_thread |
1002 // might not be suspended. | |
1003 if (owning_thread != NULL) { | |
1002 // The monitor's owner either has to be the current thread, at safepoint | 1004 // The monitor's owner either has to be the current thread, at safepoint |
1003 // or it has to be suspended. Any of these conditions will prevent both | 1005 // or it has to be suspended. Any of these conditions will prevent both |
1004 // contending and waiting threads from modifying the state of | 1006 // contending and waiting threads from modifying the state of |
1005 // the monitor. | 1007 // the monitor. |
1006 if (!at_safepoint && !JvmtiEnv::is_thread_fully_suspended(owning_thread, true, &debug_bits)) { | 1008 if (!at_safepoint && !JvmtiEnv::is_thread_fully_suspended(owning_thread, true, &debug_bits)) { |
1009 // Don't worry! This return of JVMTI_ERROR_THREAD_NOT_SUSPENDED | |
1010 // will not make it back to the JVM/TI agent. The error code will | |
1011 // get intercepted in JvmtiEnv::GetObjectMonitorUsage() which | |
1012 // will retry the call via a VM_GetObjectMonitorUsage VM op. | |
1007 return JVMTI_ERROR_THREAD_NOT_SUSPENDED; | 1013 return JVMTI_ERROR_THREAD_NOT_SUSPENDED; |
1008 } | 1014 } |
1009 HandleMark hm; | 1015 HandleMark hm; |
1010 Handle th(owning_thread->threadObj()); | 1016 Handle th(owning_thread->threadObj()); |
1011 ret.owner = (jthread)jni_reference(calling_thread, th); | 1017 ret.owner = (jthread)jni_reference(calling_thread, th); |