RFR: Fix another deadlock with oom_during_evacuation()

Roman Kennke rkennke at redhat.com
Wed Jan 11 11:35:40 UTC 2017


I encounter another deadlock involving oom_during_evacuation():

1. One (or more) Java threads get into oom_during_evacuation(), waiting
for _evacuation_in_progress to become false.
2. Some other thread(s) tries to execute a VM task (non-Shenandoah).
The safepoint-begin protocol acquires the Threads_lock.
3. The ShenandoahConcurrentThread tries to turn off evacuation, and
this attempts to acquire the Threads_lock too, but can't because of 2.
2 is waiting for 1 to get to a safepoint. 1 cannot get there as long as
3 hasn't turned off evacuation. -> deadlock

My solution is to set the _evacuation_in_progress flag to false without
the Threads_lock. Threads_lock is only required when turning off the
thread-local flag. This allows 1 to proceed and get to a safepoint, and
thus resolve the deadlock.

http://cr.openjdk.java.net/~rkennke/fixoomdeadlock/webrev.00/

Ok to push? I would also like to push this to jdk8 right away.

Roman


More information about the shenandoah-dev mailing list