mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8212155: Race condition when posting dynamic_code_generated event leads to JVM crash
Reviewed-by: sspitsyn, dcubed
This commit is contained in:
parent
cd0678fcf6
commit
64ec8b3e5c
3 changed files with 122 additions and 6 deletions
|
@ -2289,13 +2289,15 @@ void JvmtiExport::post_dynamic_code_generated_while_holding_locks(const char* na
|
|||
// register the stub with the current dynamic code event collector
|
||||
// Cannot take safepoint here so do not use state_for to get
|
||||
// jvmti thread state.
|
||||
// The collector and/or state might be NULL if JvmtiDynamicCodeEventCollector
|
||||
// has been initialized while JVMTI_EVENT_DYNAMIC_CODE_GENERATED was disabled.
|
||||
JvmtiThreadState* state = JavaThread::current()->jvmti_thread_state();
|
||||
// state can only be NULL if the current thread is exiting which
|
||||
// should not happen since we're trying to post an event
|
||||
guarantee(state != NULL, "attempt to register stub via an exiting thread");
|
||||
JvmtiDynamicCodeEventCollector* collector = state->get_dynamic_code_event_collector();
|
||||
guarantee(collector != NULL, "attempt to register stub without event collector");
|
||||
collector->register_stub(name, code_begin, code_end);
|
||||
if (state != NULL) {
|
||||
JvmtiDynamicCodeEventCollector *collector = state->get_dynamic_code_event_collector();
|
||||
if (collector != NULL) {
|
||||
collector->register_stub(name, code_begin, code_end);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Collect all the vm internally allocated objects which are visible to java world
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue