RFR: 8257817: Shenandoah: Don't race with conc-weak-in-progress flag in weak-LRB

Roman Kennke rkennke at openjdk.java.net
Mon Dec 7 11:47:20 UTC 2020


The weak-LRB code is currently subject to a race. Consider this sequence of events between a Java thread and GC threads:
During conc-weak-root-in-progress:
- Java: Load referent out of Reference, it is unreachable but not-yet-cleared
- GC: Clears referent
- GC: Concurrently turn off conc-weak-root-in-progress
- Java: Checks conc-weak-root-in-progress, sees that it's false, continues to use/evac it -> successfully resurrected unreachable object. This must not happen.

AFAICT, this also affects conc-class-unloading and weak-roots. 

Proposed fix is to check for evac-in-progress instead. This should be acceptable because this is not a very common path and not very performance-sensitive.

 - [x] hotspot_gc_shenandoah

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

Commit messages:
 - Shenandoah: Don't race with conc-weak-in-progress flag in weak-LRB

Changes: https://git.openjdk.java.net/jdk/pull/1662/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=1662&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8257817
  Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1662.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1662/head:pull/1662

PR: https://git.openjdk.java.net/jdk/pull/1662


More information about the shenandoah-dev mailing list