RFR(sh/jdk8): Fix racy update of code roots

Roman Kennke rkennke at redhat.com
Tue Dec 8 20:34:02 UTC 2020


This is jdk8-specific (I have checked jdk16 and jdk11 and they don't 
have this problem).

There is a race in ShenadoahRootUpdater: threads go into 
threads::oops_do() with a CodeBlobClosure and then they *also* go into 
ShenandoahCodeRoots::oops_do(). This leads to visiting nmethods 
concurrently, which is problematic because fix_relocations() is not 
MT-safe and will mess up oops in nmethods.

Conservative fix:
http://cr.openjdk.java.net/~rkennke/fixracycodecacheupdate/webrev.00/

(jdk11 and even more so jdk16 go further than this and remove the 
update_code_cache path altogether, but I don't want to attempt this in 
jdk8 just now)

This bug was exposed by the recent Cassandra-related bug report test-case:
https://mail.openjdk.java.net/pipermail/shenandoah-dev/2020-December/014044.html


and I verified that the bug is fixed by that.

Also: hotspot_gc_shenandoah

Ok?



More information about the shenandoah-dev mailing list