Bug: https://bugs.openjdk.java.net/browse/JDK-8212178
See the details in the bug. We are hitting this race when Shenandoah is running in aggressive mode and evacuates lots of objects all the time, processing references very often. This makes weak reference reclamation races very visible. Fix: http://cr.openjdk.java.net/~shade/8212178/webrev.01/ I took the liberty of rewriting the entire method to make it more straightforward. New code guarantees we never return "null" from this method. Testing: failing tests, jdk:tier1, jdk-submit (running) Thanks, -Aleksey