<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<br>
<div class="moz-cite-prefix">On 05/06/2013 09:42 PM, Peter Levart
wrote:<br>
</div>
<blockquote cite="mid:518807AE.7040708@gmail.com" type="cite"><!--[if !IE]><DIV style="border-left: 2px solid #009900; border-right: 2px solid #009900; padding: 0px 15px; margin: 2px 0px;"><![endif]-->
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<br>
<div class="moz-cite-prefix">On 05/06/2013 05:03 PM, Alan Bateman
wrote:<br>
</div>
<blockquote cite="mid:5187C649.60903@oracle.com" type="cite"><!--[if !IE]><DIV style="border-left: 2px solid #009900; border-right: 2px solid #009900; padding: 0px 15px; margin: 2px 0px;"><![endif]--><!--[if !IE]><DIV style="border-left: 2px solid #009900; border-right: 2px solid #009900; padding: 0px 15px; margin: 2px 0px;"><![endif]-->On
06/05/2013 09:02, Thomas Schatzl wrote: <br>
<blockquote type="cite"><!--[if !IE]><DIV style="border-left: 2px solid #009900; border-right: 2px solid #009900; padding: 0px 15px; margin: 2px 0px;"><![endif]--><!--[if !IE]><DIV style="border-left: 2px solid #009900; border-right: 2px solid #009900; padding: 0px 15px; margin: 2px 0px;"><![endif]-->:
<br>
<br>
Alan also mentioned something about instrumentation that can
add memory <br>
allocations basically anywhere. <br>
As the reference handler code is plain java code, it will be
affected as <br>
other java code. <br>
<!--[if !IE]></DIV><![endif]--><!--[if !IE]></DIV><![endif]--></blockquote>
I mentioned instrumentation on the off-chance that there was
more to this puzzle. <br>
<br>
I think Peter is right and the allocation of the
InterruptedException seems to be the only place where OOME is
possible in this code. Do you know if these tests call
Thread.interrupt on random threads (maybe as a stress test)? It
is possible to get a reference to the Reference Handler thread
via Thread.getAllStackTraces and a few other APIs so maybe this
what is going on. If the tests aren't calling interrupt on
random threads then it suggests to me that there is something
else going on, maybe there is a lurking VM bug. <br>
<br>
In any case, it seems safe to catch/ignore OOME here. One of the
mails mentioned ThreadDeath and I don't know if want to expand
the scope of the patch. That seems a case where it should be
like the Cleaner and terminate the VM. <br>
<!--[if !IE]></DIV><![endif]--><!--[if !IE]></DIV><![endif]--></blockquote>
<br>
I mentioned ThreadDeath as another possibility, similar to
InterruptedException, that could cause OOME. OOME that would
result from unsuccessful allocation of ThreadDeath error object in
victim thread should not be ignored though. But it seems that JVM
designers have already taken care of that, because contrary to
InterruptedException the ThreadDeath error object is allocated in
thread executing Thread.stop() method and this instance is later
raised as exception in victim thread. So OOME in Object.wait() can
only be caused by unsuccessful allocation of InterruptedException
and nothing else. That was my final conclusion. ThreadDeath thrown
in ReferenceHandler thread should not be caught and ignored.<br>
<!--[if !IE]></DIV><![endif]--></blockquote>
<br>
If anyone is stop()-ing ReferenceHandler thread then it should be
stopped. Speaking of that, if ThreadDeath is thrown in the middle of
Cleaner's thunk.run() processing, then the Cleaner will exit JVM. I
think ThreadDeath should be separately caught and re-thrown instead.<br>
<br>
Regards, Peter<br>
<br>
<blockquote cite="mid:518807AE.7040708@gmail.com" type="cite"><!--[if !IE]><DIV style="border-left: 2px solid #009900; border-right: 2px solid #009900; padding: 0px 15px; margin: 2px 0px;"><![endif]-->
<br>
Regards, Peter<br>
<br>
<blockquote cite="mid:5187C649.60903@oracle.com" type="cite"><!--[if !IE]><DIV style="border-left: 2px solid #009900; border-right: 2px solid #009900; padding: 0px 15px; margin: 2px 0px;"><![endif]--><!--[if !IE]><DIV style="border-left: 2px solid #009900; border-right: 2px solid #009900; padding: 0px 15px; margin: 2px 0px;"><![endif]-->
<br>
-Alan. <br>
<br>
<br>
<!--[if !IE]></DIV><![endif]--><!--[if !IE]></DIV><![endif]--></blockquote>
<br>
<!--[if !IE]></DIV><![endif]--></blockquote>
<br>
</body>
</html>