Uploaded image for project: 'Harmony'
  1. Harmony
  2. HARMONY-6084

[eut][drlvm][classunloading] classunloading test of EUT35 fails with drlvm

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 5.0M8
    • None
    • DRLVM
    • None
    • All

    Description

      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);
      }

      Attachments

        Activity

          People

            Unassigned Unassigned
            chunrong lai Chunrong Lai
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: