JDK-8263549 : 8263412 can cause jtreg testlibrary split
  • Type: Bug
  • Component: hotspot
  • Sub-Component: test
  • Affected Version: 17
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-03-13
  • Updated: 2021-11-04
  • Resolved: 2021-03-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 17
17 b14Fixed
Related Reports
Relates :  
Relates :  
Description
after JDK-8263412, we might (again) encounter NCDFE b/c parts of testlibraries aren't on the classpath. this happens when jtreg builds `jdk.test.lib.helpers.ClassFileInstaller` as a part of test-specific code, but `ClassFileInstaller` as part of shared testibrary directory in one test, when in the following test, jtreg sees `ClassFileInstaller` in the shared directory, hence javac won't recompile it/its dependencies, but in runtime `jdk.test.lib.helpers.ClassFileInstaller` is nowhere to be found, hence we get NCDFE.
TEST: runtime/cds/appcds/customLoader/HelloCustom_JFR.java
...
[2021-03-13T02:00:07,610Z]         ClassFileInstaller -jar hello.jar HelloUnload jdk.test.lib.classloader.ClassUnloadCommon 'jdk.test.lib.classloader.ClassUnloadCommon$1' 'jdk.test.lib.classloader.ClassUnloadCommon$TestFailure'
[2021-03-13T02:00:07,610Z] STDERR:
[2021-03-13T02:00:07,610Z] java.lang.NoClassDefFoundError: jdk/test/lib/helpers/ClassFileInstaller
[2021-03-13T02:00:07,610Z] 	at ClassFileInstaller.main(ClassFileInstaller.java:63)
[2021-03-13T02:00:07,610Z] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[2021-03-13T02:00:07,610Z] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
[2021-03-13T02:00:07,610Z] 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[2021-03-13T02:00:07,610Z] 	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
[2021-03-13T02:00:07,610Z] 	at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:298)
[2021-03-13T02:00:07,610Z] 	at java.base/java.lang.Thread.run(Thread.java:831)
[2021-03-13T02:00:07,610Z] Caused by: java.lang.ClassNotFoundException: jdk.test.lib.helpers.ClassFileInstaller
[2021-03-13T02:00:07,610Z] 	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:432)
[2021-03-13T02:00:07,610Z] 	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:586)
[2021-03-13T02:00:07,610Z] 	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:519)
[2021-03-13T02:00:07,610Z] 	... 7 more
[2021-03-13T02:00:07,610Z] 
[2021-03-13T02:00:07,610Z] JavaTest Message: Test threw exception: java.lang.NoClassDefFoundError
[2021-03-13T02:00:07,610Z] JavaTest Message: shutting down test
Comments
The underlying cause is CODETOOLS-7902847 . See this bug for an analysis and a simple reproducer.
04-11-2021

Changeset: a7aba2b6 Author: Igor Ignatyev <iignatyev@openjdk.org> Date: 2021-03-13 14:51:53 +0000 URL: https://git.openjdk.java.net/jdk/commit/a7aba2b6
13-03-2021

Bumped to a P2 since this causes a huge number of failures in the CI starting with Tier3.
13-03-2021

one way to solve that would be to replace all usages of `ClassFileInstaller` w/ `jdk.test.lib.helpers.ClassFileInstaller`, this effectively would restore the behavior as it was before JDK-8263412, however that means 800+ tests will have to be updated.
13-03-2021

it's worth noting that a) the failure is intermittent and depends on the test execution order; b) the "split" is caused not by the failing tests, but rather by some test executed before them.
13-03-2021