This is not a hotspot issue so I'm moving this to core-libs, please
drop hotspot from any replies.
On 20/12/2013 6:26 AM, srikalyan wrote:
Hi all, I have been working on the bug JDK-8022321
<https://bugs.openjdk.java.net/browse/JDK-8022321> , this is a
failure and the webrev is available here
I'm really not sure what to make of this. We have a test that
an out-of-memory condition but the OOME can actually turn up in the
ReferenceHandler thread causing it to terminate and the test to
We previously accounted for the non-obvious occurrences of OOME
the Object.wait and the possible need to load the
class - but still the OOME can appear where we don't want it. So
finally you have just placed the whole for(;;) loop in a
try/catch(OOME) that ignores the OOME. I'm certain that makes the
happy, but I'm not sure it is really what we want for the
ReferenceHandler thread. If the OOME occurs while cleaning, or
enqueuing then we will fail to clean and/or enqueue but there
no indication that has occurred and I think that is a bigger problem
than this test failing.
There may be no way to make this test 100% reliable. In fact I'd
suggest that no memory exhaustion test can be 100% reliable.
**"Root Cause:Still not known"*
2 places where there is a possibility for OOME
1) The cleanup code in turn has 2 places where there is
a) thunk Thread which is run from clean() method. This
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
clean() method but for this object to be created and to be held
responsible for OOME an Exception(other than OOME) has to be
2) No new heap objects are created in the enqueue method nor
the deep call stack (VM.addFinalRefCount() etc) so this cannot be a
*Experimental change to java.lang.Reference.java* :
- Put one more guard (try catch with OOME block) in the Reference
Handler Thread which may give the Reference Handler a chance to
This is fixing the test failure (several 1000 runs with 0 failures)
- Without the above change the test fails atleast 3-5 times for
*PS*: The code change is to a very critical part of JDK and i am
not aware of the consequences of the change, hence seeking
here. Appreciate your time and inputs towards this.