[16] 8247736: Shenandoah: assert(_nm->is_alive()) failed: only alive nmethods here

Zhengyu Gu zgu at redhat.com
Mon Jun 22 14:12:25 UTC 2020


The assertion is unreliable, as a nmethod can become a zombie before it 
is unregistered, and nmethod's state change can race against concurrent 
nmethod iteration, since they are under two different locks.

We did not see this assertion before JDK-8245961, because we used 
CodeCache::blobs_do() to scan code cache and did not have the assertion 
on its code path.

Ideally, I would prefer to keep nmethod list hygienic: unregister the 
nmethod before making state transition. However, offline discussion with 
Erik, he convinced me that could have unexpected consequences and risky. 
Mark through and evacuate/disarm zombie nmethods, while undesirable, but 
harmless.

So, let's just filter out dead nmethod (still racy) and remove the 
assertion.

Bug: https://bugs.openjdk.java.net/browse/JDK-8247736
Webrev: http://cr.openjdk.java.net/~zgu/JDK-8247736/webrev.00/index.html

Test:
   hotspot_gc_shenandoah

Thanks,

-Zhengyu



More information about the hotspot-gc-dev mailing list