Analysis on JDK-8022321 java/lang/ref/ fails intermittently

srikalyan srikalyan.chandrashekar at
Thu Dec 19 12:26:51 PST 2013

Hi all,  I have been working on the bug JDK-8022321 
<> , this is a sporadic 
failure and the webrev is available here
**"Root Cause:Still not known"*
2 places where there is a possibility for OOME
1) Cleaner.clean()
2) ReferenceQueue.enqueue()

1)  The cleanup code in turn has 2 places where there is potential for 
throwing OOME,
     a) thunk Thread which is run from clean() method. This Runnable is 
passed to Cleaner and appears in the following classes
However none of the above overridden implementations ever create an 
object in the clean() code.
     b) new PrivilegedAction created in try catch Exception block of 
clean() method but for this object to be created and to be held 
responsible for OOME an Exception(other than OOME) has to be thrown.

2) No new heap objects are created in the enqueue method nor anywhere in 
the deep call stack (VM.addFinalRefCount() etc) so this cannot be a 
potential cause.

*Experimental change to* :
- Put one more guard (try catch with OOME block) in the Reference 
Handler Thread which may give the Reference Handler a chance to cleanup. 
This is fixing the test failure (several 1000 runs with 0 failures)
- Without the above change the test fails atleast 3-5 times for every 
1000 run.

*PS*: The code change is to a very critical part of JDK and i am fully 
not aware of the consequences of the change, hence seeking expert help 
here. Appreciate your time and inputs towards this.

Ph: (408)-585-8040

More information about the hotspot-dev mailing list