mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8028073: race condition in ObjectMonitor implementation causing deadlocks
Move redo of ParkEvent.unpark() after JVMTI_EVENT_MONITOR_WAITED event handler is called. Reviewed-by: dholmes, sspitsyn, dice, acorn
This commit is contained in:
parent
dd25d6fed0
commit
cf5c3370a3
2 changed files with 47 additions and 17 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -518,6 +518,12 @@ JVM_ENTRY(void, JVM_MonitorWait(JNIEnv* env, jobject handle, jlong ms))
|
|||
JavaThreadInObjectWaitState jtiows(thread, ms != 0);
|
||||
if (JvmtiExport::should_post_monitor_wait()) {
|
||||
JvmtiExport::post_monitor_wait((JavaThread *)THREAD, (oop)obj(), ms);
|
||||
|
||||
// The current thread already owns the monitor and it has not yet
|
||||
// been added to the wait queue so the current thread cannot be
|
||||
// made the successor. This means that the JVMTI_EVENT_MONITOR_WAIT
|
||||
// event handler cannot accidentally consume an unpark() meant for
|
||||
// the ParkEvent associated with this ObjectMonitor.
|
||||
}
|
||||
ObjectSynchronizer::wait(obj, ms, CHECK);
|
||||
JVM_END
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue