RFR 8135188: RunFinalizationTest.java Exception java.lang.Error: Test failure: Object was not finalized
Martin Buchholz
martinrb at google.com
Wed Oct 14 22:24:30 UTC 2015
Looks good, but cant-stop-nitpicking Martin feels compelled to point out
the typo here:
71 // his instance will be used to perform the GC.run_finalization test
On Tue, Oct 13, 2015 at 11:47 PM, Jaroslav Bachorik <
jaroslav.bachorik at oracle.com> wrote:
> On 13.10.2015 20:12, Martin Buchholz wrote:
>
>> blockFinalizerThread looks buggy to me.
>>
>> 103 private static void blockFinalizerThread() throws
>> InterruptedException {
>> 104 System.out.println("trying to block the finalizer thread");
>> 105 o1 = new MyObject();
>> 106 o1 = null;
>> 107 System.gc();
>> 108 System.runFinalization();
>> 109 finRunLatch.await();
>> 110 }
>> Why are you calling System.runFinalization() ? You are trying to block
>> the primary finalizer thread; you definitely don't want the object to be
>> handled by the secondary finalizer thread.
>>
>
> Indeed. Even though this seems unlikely (didn't hit the problem in 500
> repetitions) it will be better not to call System.runFinalization() and
> just let System.gc() do its job finalizing the collected instance.
>
>
>> ---
>>
>> 51 } else {
>> 52 System.out.println("finalizing the test instance");
>> I would check :
>>
>> else if (Thread.currentThread().getName().equals("Secondary finalizer")) {
>> ....
>> else fail(unexpected finalizer thread name)
>>
>
> If this ever happens it would mean that the finalizer logic has been
> changed. Adding this check will make the test fail in such case and force
> re-examination of the test logic. Sounds fair.
>
> http://cr.openjdk.java.net/~jbachorik/8135188/webrev.04
>
> Thanks!
>
> -JB-
>
>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/serviceability-dev/attachments/20151014/07ed4462/attachment-0001.html>
More information about the serviceability-dev
mailing list