(Preliminary) RFC 7038914: VM could throw uncaught OOME in ReferenceHandler thread
Peter Levart
peter.levart at gmail.com
Fri May 3 19:25:21 UTC 2013
On 05/03/2013 07:47 PM, Thomas Schatzl wrote:
> Hi,
>> Hi Tomas,
>>
>> I don't know if this is the case here, but what if the
>> ReferenceHandler thread is interrupted while wait()-ing and the
>> construction of InterruptedException triggers OOME?
> I am sure this is the case - previously I thought InterruptedException
> is a preallocated exception like others.
> ObjectMonitor::wait() may throw it, by creating new InterruptedException
> instances.
>
> Thanks!
>
> Now that we've found the very likely cause, what to do about it?
Maybe just ignore it since if it happens during wait(), the cause is
supposed to be interrupted thread and the InterruptedException that was
to be thrown would be ignored too:
try {
lock.wait();
} catch (InterruptedException |
OutOfMemoryError x) { }
Regards, Peter
> The current state of silently crashing the reference handler thread is
> unsatisfying imo as it leads to very hard to find problems.
>
> The options I see all involve catching this (or any other OOME caused by
> other means like the test program) and either recovering as much as
> possible or exiting the VM (like in the sun.misc.Cleaner handling).
>
> Any other suggestions?
>
> Thanks,
> Thomas
>
More information about the core-libs-dev
mailing list