RFR: Use timed wait to sleep control thread [v2]

earthling-amzn github.com+71722661+earthling-amzn at openjdk.java.net
Wed Apr 7 20:31:10 UTC 2021


On Wed, 7 Apr 2021 18:47:03 GMT, earthling-amzn <github.com+71722661+earthling-amzn at openjdk.org> wrote:

>> src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp line 768:
>> 
>>> 766:     _gc_requested.set();
>>> 767:     _requested_gc_cause = cause;
>>> 768:     notify_control_thread();
>> 
>> So this thing holds `_gc_waiters_lock`. I noticed it when trying to implement JDK-8264851. Fastdebug builds would fail with: `#  assert(false) failed: Attempting to acquire lock ShenandoahControlWaitGC_lock/11 out of order with lock ShenandoahRequestedGC_lock/11 -- possible deadlock`. How is that handled here?
>
> Looking into this.

I think this is a false positive. There's no deadlock here because the control thread never tries to hold both these locks at the same time. I changed the rank of the `_gc_waiters_lock` to allow a thread to hold them both.

-------------

PR: https://git.openjdk.java.net/shenandoah/pull/28


More information about the shenandoah-dev mailing list