RFR 8135188: RunFinalizationTest.java Exception java.lang.Error: Test failure: Object was not finalized

Jaroslav Bachorik jaroslav.bachorik at oracle.com
Thu Oct 15 06:12:13 UTC 2015


On 15.10.2015 00:24, Martin Buchholz wrote:
> 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

Hopefully, it is not necessary to repost the updated webrev. Or is it?

-JB-

>
>
>
> On Tue, Oct 13, 2015 at 11:47 PM, Jaroslav Bachorik
> <jaroslav.bachorik at oracle.com <mailto:jaroslav.bachorik at oracle.com>> wrote:
>
>     On 13.10.2015 <tel: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-
>
>
>
>
>



More information about the serviceability-dev mailing list