RFR(xs): 8134749: SoftReferences declared dead too early
per.liden at oracle.com
Mon Aug 31 14:15:50 UTC 2015
While preparing a different patch I looked through the
ReferenceProcessor and noticed what looks like a silent mistreatment of
Summary: RefProcPhase1Task uses WorkerThread::id() to select the list to
process. After the recent changes to how WorkGang works, this no
longer guarantees that all reference lists are processed. This in turn
means we might kill SoftReferences even when the policy says they should
be kept alive.
The fix here would be to use the worker_id (named "i" in this code)
passed into the Task's work() function instead of using WorkerThread::id().
 There's no longer any guarantee that all GangWorker threads will
execute the Task's work() function, since a quick-to-wakeup worker
thread might steal the work intended for a slow-to-wakeup worker thread.
Btw, I'll to send out a follow-up patch (JDK-8134744) which makes sure
WorkerThread::id() and the worker_id always match to avoid this type of
bugs in the future.
More information about the hotspot-gc-dev