Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8304696

Duplicate class names in dynamicArchive tests can lead to test failure

    XMLWordPrintable

Details

    • b20

    Backports

      Description

        I was running all the runtime/cds/appcds/dynamicArchive tests and had an unexpected and strange failure in LambdaProxyDuringShutdown.java:

        java.lang.RuntimeException: 'class.load.*Outer[$]Inner[$][$]Lambda.*0x.*source:.Outer' missing from stdout/stderr

        When I examined the log there was no sign that the installed shutdown hook had executed, causing the Outer and Inner classes to be loaded. After much experimentation and head scratching I did observe some unexpected output:

        shut down hook invoked...

        Searching the sources this comes from:

        class MyShutdown extends Thread{
            public void run(){
                System.out.println("shut down hook invoked...");
            }
        }

        in class LinkClassApp - which is a different test! The problem is that LambdaProxyDuringShutdownApp also has this:

        class MyShutdown extends Thread {
            public void run() {
                Outer.Inner inner = new Outer.Inner();
            }
        }

        and it became evident that when running the tests locally, under the right/wrong conditions the LambdaProxy test was using the LinkClass test's MyShutdown class. Sure enough this class gets compiled into:

        JTwork/classes/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/test-classes

        which is shared by both tests.

        Simple fix is to rename one of the classes so there is no duplication.

        Attachments

          Issue Links

            Activity

              People

                ccheung Calvin Cheung
                dholmes David Holmes
                Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: