[11] RFR(S): 8205472: Deadlock in Kitchensink when trying to print compile queues causing timeout
David Holmes
david.holmes at oracle.com
Tue Jul 10 02:16:15 UTC 2018
Hi Tobias,
On 9/07/2018 9:58 PM, Tobias Hartmann wrote:
> Hi,
>
> please review the following patch:
> https://bugs.openjdk.java.net/browse/JDK-8205472
> http://cr.openjdk.java.net/~thartmann/8205472/webrev.00/
>
> When registering a compiled method in ciEnv::register_method() the compiler thread acquires the
> MethodCompileQueue_lock and then performs a safepoint check before acquiring the Compile_lock as
> well. If we enter a safepoint, the compiler thread is still holding the MethodCompileQueue_lock
> while the VM thread may execute the VM_PrintCompileQueue VM operation which requires the
> MethodCompileQueue_lock as well. We deadlock.
>
> This bug is very intermittent and I was only able to reproduce it by modifying the VM to always
> enter a safepoint (see comments in JIRA). The solution is to not acquire the MethodCompileQueue_lock
> in CompileBroker::print_compile_queues() because we only execute that code at a safepoint anyway
> (VM_PrintCompileQueue has evaluation_mode() == _safepoint).
Note that what you describe is only one half of the safety issue here.
Executing the code only at a safepoint ensures some degree of mutual
exclusion, but you also have to ensure that other code that would
acquire that lock, can not enter a safepoint with that lock held, when
the state protected by the lock may be inconsistent with the logic that
will be executed at the safepoint.
Cheers,
David
> Thanks,
> Tobias
>
More information about the hotspot-dev
mailing list