RFR: 8197812: (ref) Data race in Finalizer

Peter Levart peter.levart at gmail.com
Wed Feb 14 08:19:55 UTC 2018


Hi Martin,

On 02/14/2018 07:58 AM, Peter Levart wrote:
> It may be that the intent was to refrain from using the shared 'lock' 
> lock for the 2nd and subsequent calls to runFinalizer() and only use 
> the more fine-grained 'this' lock in this case?
>
> If someone was able to call runFinalizer() on the same instance in a 
> loop he could prevent or slow-down normal processing of other 
> Finalizer(s) if the shared 'lock' was always employed. What do you think? 

I checked all uses of runFinalizer() and I don't think it can be called 
more than twice for the same Finalizer instance (for example if there is 
a race between runAllFinalizers() and processing of Finalizers taken 
from the ReferenceQueue). So your patch is a nice simplification.

Regards, Peter



More information about the core-libs-dev mailing list