harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chunrong Lai (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-6084) [eut][drlvm][classunloading] classunloading test of EUT35 fails with drlvm
Date Mon, 09 Feb 2009 04:56:59 GMT
[eut][drlvm][classunloading] classunloading test of EUT35 fails with drlvm
--------------------------------------------------------------------------

                 Key: HARMONY-6084
                 URL: https://issues.apache.org/jira/browse/HARMONY-6084
             Project: Harmony
          Issue Type: Bug
          Components: DRLVM
    Affects Versions: 5.0M8
         Environment: All
            Reporter: Chunrong Lai



 In org.eclipse.ui.tests of EUT, some classunloading errors like "testClass() for ..." are
found.
 I see EUT just invokes GC 100 times after a class has been useless to guarantee the class
is unloaded.
 On the other hand, Drlvm just does class unloading in its "major GC". So a class can be just
not unloaded when running EUT. But forcing every GC as major GC will pass the related EUT
tests.

 The error is not difficult to be fixed by one of below approaches:
 (1) Change the classunloading mechanism of drlvm to let it happens in every GC.
 (2) Change the gc_force_gc implementation to give a certain priority to "major GC".
 (3) Claim the test case as invalid because the SPEC does not guarantee a class is unloaded.
 I prefered (2), suggestions?

 Some EUT sources are also listed for reference:
 public void testClass() throws Exception {	
   setName("testClass() for " + getClass().getName());
   Bundle bundle = getBundle();
   Class clazz = bundle.loadClass(className);
    assertNotNull(clazz);
    ReferenceQueue myQueue = new ReferenceQueue();
    WeakReference ref = new WeakReference(clazz.getClassLoader(), myQueue);
    clazz = null; //null our refs
    bundle = null;
    removeBundle();
    checkRef(myQueue, ref);
}
 
public static void checkRef(ReferenceQueue queue, Reference ref)
            throws IllegalArgumentException, InterruptedException {
     boolean flag = false;
     for (int i = 0; i < 100; i++) {
         System.runFinalization();
         System.gc();
         Thread.yield();
         processEvents();
         Reference checkRef = queue.remove(100);
         if (checkRef != null && checkRef.equals(ref)) {
             flag = true;
             break;
         }
      }

      assertTrue("Reference not enqueued", flag);
}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message