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

Martin Buchholz martinrb at google.com
Tue Oct 13 18:12:11 UTC 2015


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.

---

  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)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/serviceability-dev/attachments/20151013/b53f1474/attachment.html>


More information about the serviceability-dev mailing list