JDK-8289561 : java/lang/instrument/NativeMethodPrefixAgent.java fails with "ERROR: Injection failure: java.lang.UnsupportedOperationException: Records requires ASM8"
  • Type: Bug
  • Component: core-svc
  • Sub-Component: java.lang.instrument
  • Affected Version: 19
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows
  • CPU: x86_64
  • Submitted: 2022-07-01
  • Updated: 2022-10-10
  • Resolved: 2022-10-07
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 20
20 masterFixed
Related Reports
Relates :  
Description
The following test failed in the JDK19 CI:

java/lang/instrument/NativeMethodPrefixAgent.java

Here's a snippet from the log file:

----------System.err:(318/26936)----------
ERROR: Injection failure: java.lang.UnsupportedOperationException: Records requires ASM8
java.lang.UnsupportedOperationException: Records requires ASM8
	at java.base/jdk.internal.org.objectweb.asm.ClassVisitor.visit(ClassVisitor.java:139)
	at asmlib.Instrumentor$2.visit(Instrumentor.java:134)
	at java.base/jdk.internal.org.objectweb.asm.ClassReader.accept(ClassReader.java:601)
	at java.base/jdk.internal.org.objectweb.asm.ClassReader.accept(ClassReader.java:456)
	at asmlib.Instrumentor.apply(Instrumentor.java:189)
	at NativeMethodPrefixAgent$Tr.transform(NativeMethodPrefixAgent.java:78)
	at java.instrument/java.lang.instrument.ClassFileTransformer.transform(ClassFileTransformer.java:244)
	at java.instrument/sun.instrument.TransformerManager.transform(TransformerManager.java:188)
	at java.instrument/sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:541)
	at java.base/jdk.internal.misc.ThreadTracker.begin(ThreadTracker.java:70)
	at java.base/java.util.jar.JarFile.beginInit(JarFile.java:1042)
	at java.base/java.util.jar.JarFile.ensureInitialization(JarFile.java:1056)
	at java.base/java.util.jar.JavaUtilJarAccessImpl.ensureInitialization(JavaUtilJarAccessImpl.java:72)
	at java.base/jdk.internal.loader.URLClassPath$JarLoader$2.getManifest(URLClassPath.java:883)
	at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:848)
	at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:760)
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:681)
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:495)
	at java.base/java.lang.Class.forName(Class.java:474)
	at java.base/sun.launcher.LauncherHelper.loadMainClass(LauncherHelper.java:790)
	at java.base/sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:685)
Returning bad class file, to cause test failure
ERROR: Injection failure: java.lang.UnsupportedOperationException: Records requires ASM8
java.lang.UnsupportedOperationException: Records requires ASM8
	at java.base/jdk.internal.org.objectweb.asm.ClassVisitor.visit(ClassVisitor.java:139)
	at asmlib.Instrumentor$2.visit(Instrumentor.java:134)
	at java.base/jdk.internal.org.objectweb.asm.ClassReader.accept(ClassReader.java:601)
	at java.base/jdk.internal.org.objectweb.asm.ClassReader.accept(ClassReader.java:456)
	at asmlib.Instrumentor.apply(Instrumentor.java:189)
	at NativeMethodPrefixAgent$Tr.transform(NativeMethodPrefixAgent.java:78)
	at java.instrument/java.lang.instrument.ClassFileTransformer.transform(ClassFileTransformer.java:244)
	at java.instrument/sun.instrument.TransformerManager.transform(TransformerManager.java:188)
	at java.instrument/sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:541)
	at java.base/jdk.internal.misc.ThreadTracker.begin(ThreadTracker.java:70)
	at java.base/java.util.jar.JarFile.beginInit(JarFile.java:1042)
	at java.base/java.util.jar.JarFile.ensureInitialization(JarFile.java:1056)
	at java.base/java.util.jar.JavaUtilJarAccessImpl.ensureInitialization(JavaUtilJarAccessImpl.java:72)
	at java.base/jdk.internal.loader.URLClassPath$JarLoader$2.getManifest(URLClassPath.java:883)
	at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:848)
	at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:760)
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:681)
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:495)
	at java.base/java.lang.Class.forName(Class.java:474)
	at java.base/sun.launcher.LauncherHelper.loadMainClass(LauncherHelper.java:790)
	at java.base/sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:685)
Returning bad class file, to cause test failure
ERROR: Injection failure: java.lang.ArrayIndexOutOfBoundsException: Index 6 out of bounds for length 0
java.lang.ArrayIndexOutOfBoundsException: Index 6 out of bounds for length 0
	at java.base/jdk.internal.org.objectweb.asm.ClassReader.readShort(ClassReader.java:3640)
	at java.base/jdk.internal.org.objectweb.asm.ClassReader.<init>(ClassReader.java:229)
	at java.base/jdk.internal.org.objectweb.asm.ClassReader.<init>(ClassReader.java:212)
	at java.base/jdk.internal.org.objectweb.asm.ClassReader.<init>(ClassReader.java:198)
	at asmlib.Instrumentor.<init>(Instrumentor.java:99)
	at asmlib.Instrumentor.instrFor(Instrumentor.java:89)
	at NativeMethodPrefixAgent$Tr.transform(NativeMethodPrefixAgent.java:70)
	at java.instrument/java.lang.instrument.ClassFileTransformer.transform(ClassFileTransformer.java:244)
	at java.instrument/sun.instrument.TransformerManager.transform(TransformerManager.java:188)
	at java.instrument/sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:541)
	at java.base/jdk.internal.misc.ThreadTracker.begin(ThreadTracker.java:70)
	at java.base/java.util.jar.JarFile.beginInit(JarFile.java:1042)
	at java.base/java.util.jar.JarFile.ensureInitialization(JarFile.java:1056)
	at java.base/java.util.jar.JavaUtilJarAccessImpl.ensureInitialization(JavaUtilJarAccessImpl.java:72)
	at java.base/jdk.internal.loader.URLClassPath$JarLoader$2.getManifest(URLClassPath.java:883)
	at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:848)
	at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:760)
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:681)
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:495)
	at java.base/java.lang.Class.forName(Class.java:474)
	at java.base/sun.launcher.LauncherHelper.loadMainClass(LauncherHelper.java:790)
	at java.base/sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:685)
Returning bad class file, to cause test failure
start
Tracked #2: getVersion0
Tracked #1: wrapped_tr2_getVersion0
Tracked #0: wrapped_tr1_wrapped_tr2_getVersion0
Tracked #2: initOptionalSupportFields
Tracked #1: wrapped_tr2_initOptionalSupportFields
Tracked #0: wrapped_tr1_wrapped_tr2_initOptionalSupportFields
Tracked #2: getNativeMap
Tracked #1: wrapped_tr2_getNativeMap
Tracked #0: wrapped_tr1_wrapped_tr2_getNativeMap
ERROR: Injection failure: java.lang.UnsupportedOperationException: PermittedSubclasses requires ASM9
java.lang.UnsupportedOperationException: PermittedSubclasses requires ASM9
	at java.base/jdk.internal.org.objectweb.asm.ClassVisitor.visitPermittedSubclass(ClassVisitor.java:293)
	at java.base/jdk.internal.org.objectweb.asm.ClassReader.accept(ClassReader.java:738)
	at java.base/jdk.internal.org.objectweb.asm.ClassReader.accept(ClassReader.java:456)
	at asmlib.Instrumentor.apply(Instrumentor.java:189)
	at NativeMethodPrefixAgent$Tr.transform(NativeMethodPrefixAgent.java:78)
	at java.instrument/java.lang.instrument.ClassFileTransformer.transform(ClassFileTransformer.java:244)
	at java.instrument/sun.instrument.TransformerManager.transform(TransformerManager.java:188)
	at java.instrument/sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:541)
	at java.base/java.nio.DirectByteBuffer.asIntBuffer(DirectByteBuffer.java:762)
	at java.base/jdk.internal.jimage.BasicImageReader.intBuffer(BasicImageReader.java:220)
	at java.base/jdk.internal.jimage.BasicImageReader.<init>(BasicImageReader.java:154)
	at java.base/jdk.internal.jimage.ImageReader$SharedImageReader.<init>(ImageReader.java:229)
	at java.base/jdk.internal.jimage.ImageReader$SharedImageReader.open(ImageReader.java:243)
	at java.base/jdk.internal.jimage.ImageReader.open(ImageReader.java:67)
	at java.base/jdk.internal.jimage.ImageReader.open(ImageReader.java:71)
	at java.base/jdk.internal.jimage.ImageReaderFactory$1.apply(ImageReaderFactory.java:70)
	at java.base/jdk.internal.jimage.ImageReaderFactory$1.apply(ImageReaderFactory.java:67)
	at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
	at java.base/jdk.internal.jimage.ImageReaderFactory.get(ImageReaderFactory.java:61)
	at java.base/jdk.internal.jimage.ImageReaderFactory.getImageReader(ImageReaderFactory.java:85)
	at java.base/jdk.internal.module.SystemModuleFinders$SystemImage.<clinit>(SystemModuleFinders.java:385)
	at java.base/jdk.internal.module.SystemModuleFinders$SystemModuleReader.containsImageLocation(SystemModuleFinders.java:446)
	at java.base/jdk.internal.module.SystemModuleFinders$SystemModuleReader.find(SystemModuleFinders.java:457)
	at java.base/jdk.internal.loader.BuiltinClassLoader$2.run(BuiltinClassLoader.java:464)
	at java.base/jdk.internal.loader.BuiltinClassLoader$2.run(BuiltinClassLoader.java:459)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:569)
	at java.base/jdk.internal.loader.BuiltinClassLoader.findMiscResource(BuiltinClassLoader.java:458)
	at java.base/jdk.internal.loader.BuiltinClassLoader.findResources(BuiltinClassLoader.java:385)
	at java.base/jdk.internal.loader.BootLoader.findResources(BootLoader.java:190)
	at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.nextProviderClass(ServiceLoader.java:1198)
	at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1228)
	at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1273)
	at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1309)
	at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1393)
	at java.management/java.lang.management.ManagementFactory$PlatformMBeanFinder$1.run(ManagementFactory.java:933)
	at java.management/java.lang.management.ManagementFactory$PlatformMBeanFinder$1.run(ManagementFactory.java:929)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:460)
	at java.management/java.lang.management.ManagementFactory$PlatformMBeanFinder.<clinit>(ManagementFactory.java:928)
	at java.management/java.lang.management.ManagementFactory.getPlatformMXBean(ManagementFactory.java:688)
	at java.management/java.lang.management.ManagementFactory.getRuntimeMXBean(ManagementFactory.java:366)
	at NativeMethodPrefixApp.run(NativeMethodPrefixApp.java:48)
	at NativeMethodPrefixApp.main(NativeMethodPrefixApp.java:40)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	at java.base/java.lang.reflect.Method.invoke(Method.java:578)
	at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
	at java.base/java.lang.Thread.run(Thread.java:1589)
Returning bad class file, to cause test failure
ERROR: Injection failure: java.lang.UnsupportedOperationException: PermittedSubclasses requires ASM9
java.lang.UnsupportedOperationException: PermittedSubclasses requires ASM9
	at java.base/jdk.internal.org.objectweb.asm.ClassVisitor.visitPermittedSubclass(ClassVisitor.java:293)
	at java.base/jdk.internal.org.objectweb.asm.ClassReader.accept(ClassReader.java:738)
	at java.base/jdk.internal.org.objectweb.asm.ClassReader.accept(ClassReader.java:456)
	at asmlib.Instrumentor.apply(Instrumentor.java:189)
	at NativeMethodPrefixAgent$Tr.transform(NativeMethodPrefixAgent.java:78)
	at java.instrument/java.lang.instrument.ClassFileTransformer.transform(ClassFileTransformer.java:244)
	at java.instrument/sun.instrument.TransformerManager.transform(TransformerManager.java:188)
	at java.instrument/sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:541)
	at java.base/java.nio.DirectByteBuffer.asIntBuffer(DirectByteBuffer.java:762)
	at java.base/jdk.internal.jimage.BasicImageReader.intBuffer(BasicImageReader.java:220)
	at java.base/jdk.internal.jimage.BasicImageReader.<init>(BasicImageReader.java:154)
	at java.base/jdk.internal.jimage.ImageReader$SharedImageReader.<init>(ImageReader.java:229)
	at java.base/jdk.internal.jimage.ImageReader$SharedImageReader.open(ImageReader.java:243)
	at java.base/jdk.internal.jimage.ImageReader.open(ImageReader.java:67)
	at java.base/jdk.internal.jimage.ImageReader.open(ImageReader.java:71)
	at java.base/jdk.internal.jimage.ImageReaderFactory$1.apply(ImageReaderFactory.java:70)
	at java.base/jdk.internal.jimage.ImageReaderFactory$1.apply(ImageReaderFactory.java:67)
	at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
	at java.base/jdk.internal.jimage.ImageReaderFactory.get(ImageReaderFactory.java:61)
	at java.base/jdk.internal.jimage.ImageReaderFactory.getImageReader(ImageReaderFactory.java:85)
	at java.base/jdk.internal.module.SystemModuleFinders$SystemImage.<clinit>(SystemModuleFinders.java:385)
	at java.base/jdk.internal.module.SystemModuleFinders$SystemModuleReader.containsImageLocation(SystemModuleFinders.java:446)
	at java.base/jdk.internal.module.SystemModuleFinders$SystemModuleReader.find(SystemModuleFinders.java:457)
	at java.base/jdk.internal.loader.BuiltinClassLoader$2.run(BuiltinClassLoader.java:464)
	at java.base/jdk.internal.loader.BuiltinClassLoader$2.run(BuiltinClassLoader.java:459)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:569)
	at java.base/jdk.internal.loader.BuiltinClassLoader.findMiscResource(BuiltinClassLoader.java:458)
	at java.base/jdk.internal.loader.BuiltinClassLoader.findResources(BuiltinClassLoader.java:385)
	at java.base/jdk.internal.loader.BootLoader.findResources(BootLoader.java:190)
	at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.nextProviderClass(ServiceLoader.java:1198)
	at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1228)
	at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1273)
	at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1309)
	at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1393)
	at java.management/java.lang.management.ManagementFactory$PlatformMBeanFinder$1.run(ManagementFactory.java:933)
	at java.management/java.lang.management.ManagementFactory$PlatformMBeanFinder$1.run(ManagementFactory.java:929)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:460)
	at java.management/java.lang.management.ManagementFactory$PlatformMBeanFinder.<clinit>(ManagementFactory.java:928)
	at java.management/java.lang.management.ManagementFactory.getPlatformMXBean(ManagementFactory.java:688)
	at java.management/java.lang.management.ManagementFactory.getRuntimeMXBean(ManagementFactory.java:366)
	at NativeMethodPrefixApp.run(NativeMethodPrefixApp.java:48)
	at NativeMethodPrefixApp.main(NativeMethodPrefixApp.java:40)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	at java.base/java.lang.reflect.Method.invoke(Method.java:578)
	at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
	at java.base/java.lang.Thread.run(Thread.java:1589)
Returning bad class file, to cause test failure
ERROR: Injection failure: java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException
Returning bad class file, to cause test failure
ERROR: Injection failure: java.lang.UnsupportedOperationException: PermittedSubclasses requires ASM9
java.lang.UnsupportedOperationException: PermittedSubclasses requires ASM9
	at java.base/jdk.internal.org.objectweb.asm.ClassVisitor.visitPermittedSubclass(ClassVisitor.java:293)
	at java.base/jdk.internal.org.objectweb.asm.ClassReader.accept(ClassReader.java:738)
	at java.base/jdk.internal.org.objectweb.asm.ClassReader.accept(ClassReader.java:456)
	at asmlib.Instrumentor.apply(Instrumentor.java:189)
	at NativeMethodPrefixAgent$Tr.transform(NativeMethodPrefixAgent.java:78)
	at java.instrument/java.lang.instrument.ClassFileTransformer.transform(ClassFileTransformer.java:244)
	at java.instrument/sun.instrument.TransformerManager.transform(TransformerManager.java:188)
	at java.instrument/sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:541)
	at java.base/java.nio.DirectByteBuffer.asIntBuffer(DirectByteBuffer.java:762)
	at java.base/jdk.internal.jimage.BasicImageReader.intBuffer(BasicImageReader.java:220)
	at java.base/jdk.internal.jimage.BasicImageReader.<init>(BasicImageReader.java:154)
	at java.base/jdk.internal.jimage.ImageReader$SharedImageReader.<init>(ImageReader.java:229)
	at java.base/jdk.internal.jimage.ImageReader$SharedImageReader.open(ImageReader.java:243)
	at java.base/jdk.internal.jimage.ImageReader.open(ImageReader.java:67)
	at java.base/jdk.internal.jimage.ImageReader.open(ImageReader.java:71)
	at java.base/jdk.internal.jimage.ImageReaderFactory$1.apply(ImageReaderFactory.java:70)
	at java.base/jdk.internal.jimage.ImageReaderFactory$1.apply(ImageReaderFactory.java:67)
	at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
	at java.base/jdk.internal.jimage.ImageReaderFactory.get(ImageReaderFactory.java:61)
	at java.base/jdk.internal.jimage.ImageReaderFactory.getImageReader(ImageReaderFactory.java:85)
	at java.base/jdk.internal.module.SystemModuleFinders$SystemImage.<clinit>(SystemModuleFinders.java:385)
	at java.base/jdk.internal.module.SystemModuleFinders$SystemModuleReader.containsImageLocation(SystemModuleFinders.java:446)
	at java.base/jdk.internal.module.SystemModuleFinders$SystemModuleReader.find(SystemModuleFinders.java:457)
	at java.base/jdk.internal.loader.BuiltinClassLoader$2.run(BuiltinClassLoader.java:464)
	at java.base/jdk.internal.loader.BuiltinClassLoader$2.run(BuiltinClassLoader.java:459)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:569)
	at java.base/jdk.internal.loader.BuiltinClassLoader.findMiscResource(BuiltinClassLoader.java:458)
	at java.base/jdk.internal.loader.BuiltinClassLoader.findResources(BuiltinClassLoader.java:385)
	at java.base/jdk.internal.loader.BootLoader.findResources(BootLoader.java:190)
	at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.nextProviderClass(ServiceLoader.java:1198)
	at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1228)
	at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1273)
	at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1309)
	at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1393)
	at java.management/java.lang.management.ManagementFactory$PlatformMBeanFinder$1.run(ManagementFactory.java:933)
	at java.management/java.lang.management.ManagementFactory$PlatformMBeanFinder$1.run(ManagementFactory.java:929)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:460)
	at java.management/java.lang.management.ManagementFactory$PlatformMBeanFinder.<clinit>(ManagementFactory.java:928)
	at java.management/java.lang.management.ManagementFactory.getPlatformMXBean(ManagementFactory.java:688)
	at java.management/java.lang.management.ManagementFactory.getRuntimeMXBean(ManagementFactory.java:366)
	at NativeMethodPrefixApp.run(NativeMethodPrefixApp.java:48)
	at NativeMethodPrefixApp.main(NativeMethodPrefixApp.java:40)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	at java.base/java.lang.reflect.Method.invoke(Method.java:578)
	at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
	at java.base/java.lang.Thread.run(Thread.java:1589)
Returning bad class file, to cause test failure
ERROR: Injection failure: java.lang.UnsupportedOperationException: PermittedSubclasses requires ASM9
java.lang.UnsupportedOperationException: PermittedSubclasses requires ASM9
	at java.base/jdk.internal.org.objectweb.asm.ClassVisitor.visitPermittedSubclass(ClassVisitor.java:293)
	at java.base/jdk.internal.org.objectweb.asm.ClassReader.accept(ClassReader.java:738)
	at java.base/jdk.internal.org.objectweb.asm.ClassReader.accept(ClassReader.java:456)
	at asmlib.Instrumentor.apply(Instrumentor.java:189)
	at NativeMethodPrefixAgent$Tr.transform(NativeMethodPrefixAgent.java:78)
	at java.instrument/java.lang.instrument.ClassFileTransformer.transform(ClassFileTransformer.java:244)
	at java.instrument/sun.instrument.TransformerManager.transform(TransformerManager.java:188)
	at java.instrument/sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:541)
	at java.base/java.nio.DirectByteBuffer.asIntBuffer(DirectByteBuffer.java:762)
	at java.base/jdk.internal.jimage.BasicImageReader.intBuffer(BasicImageReader.java:220)
	at java.base/jdk.internal.jimage.BasicImageReader.<init>(BasicImageReader.java:154)
	at java.base/jdk.internal.jimage.ImageReader$SharedImageReader.<init>(ImageReader.java:229)
	at java.base/jdk.internal.jimage.ImageReader$SharedImageReader.open(ImageReader.java:243)
	at java.base/jdk.internal.jimage.ImageReader.open(ImageReader.java:67)
	at java.base/jdk.internal.jimage.ImageReader.open(ImageReader.java:71)
	at java.base/jdk.internal.jimage.ImageReaderFactory$1.apply(ImageReaderFactory.java:70)
	at java.base/jdk.internal.jimage.ImageReaderFactory$1.apply(ImageReaderFactory.java:67)
	at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
	at java.base/jdk.internal.jimage.ImageReaderFactory.get(ImageReaderFactory.java:61)
	at java.base/jdk.internal.jimage.ImageReaderFactory.getImageReader(ImageReaderFactory.java:85)
	at java.base/jdk.internal.module.SystemModuleFinders$SystemImage.<clinit>(SystemModuleFinders.java:385)
	at java.base/jdk.internal.module.SystemModuleFinders$SystemModuleReader.containsImageLocation(SystemModuleFinders.java:446)
	at java.base/jdk.internal.module.SystemModuleFinders$SystemModuleReader.find(SystemModuleFinders.java:457)
	at java.base/jdk.internal.loader.BuiltinClassLoader$2.run(BuiltinClassLoader.java:464)
	at java.base/jdk.internal.loader.BuiltinClassLoader$2.run(BuiltinClassLoader.java:459)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:569)
	at java.base/jdk.internal.loader.BuiltinClassLoader.findMiscResource(BuiltinClassLoader.java:458)
	at java.base/jdk.internal.loader.BuiltinClassLoader.findResources(BuiltinClassLoader.java:385)
	at java.base/jdk.internal.loader.BootLoader.findResources(BootLoader.java:190)
	at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.nextProviderClass(ServiceLoader.java:1198)
	at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1228)
	at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1273)
	at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1309)
	at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1393)
	at java.management/java.lang.management.ManagementFactory$PlatformMBeanFinder$1.run(ManagementFactory.java:933)
	at java.management/java.lang.management.ManagementFactory$PlatformMBeanFinder$1.run(ManagementFactory.java:929)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:460)
	at java.management/java.lang.management.ManagementFactory$PlatformMBeanFinder.<clinit>(ManagementFactory.java:928)
	at java.management/java.lang.management.ManagementFactory.getPlatformMXBean(ManagementFactory.java:688)
	at java.management/java.lang.management.ManagementFactory.getRuntimeMXBean(ManagementFactory.java:366)
	at NativeMethodPrefixApp.run(NativeMethodPrefixApp.java:48)
	at NativeMethodPrefixApp.main(NativeMethodPrefixApp.java:40)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	at java.base/java.lang.reflect.Method.invoke(Method.java:578)
	at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
	at java.base/java.lang.Thread.run(Thread.java:1589)
Returning bad class file, to cause test failure
ERROR: Injection failure: java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException
Returning bad class file, to cause test failure
Tracked #2: MATCHED -- getStartupTime
Tracked #1: MATCHED -- wrapped_tr2_getStartupTime
Tracked #0: MATCHED -- wrapped_tr1_wrapped_tr2_getStartupTime
Oracle Corporation
Exception in thread "Reference Handler" java.lang.ClassCircularityError: java/util/concurrent/locks/AbstractQueuedSynchronizer$ExclusiveNode
	at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer.tryInitializeHead(AbstractQueuedSynchronizer.java:567)
	at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer.enqueue(AbstractQueuedSynchronizer.java:582)
	at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.doSignal(AbstractQueuedSynchronizer.java:1454)
	at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.signalAll(AbstractQueuedSynchronizer.java:1490)

Exception: ja	at java.base/java.lang.ref.ReferenceQueue.signal(ReferenceQueue.java:63)
va	at java.base/java.lang.ref.ReferenceQueue.enqueue0(ReferenceQueue.java:106)
.lang.ClassCircularityError thrown from the UncaughtExceptionHandler in thread "main"
	at java.base/java.lang.ref.ReferenceQueue.enqueue(ReferenceQueue.java:165)
	at java.base/java.lang.ref.Reference.enqueueFromPending(Reference.java:234)
	at java.base/java.lang.ref.Reference.processPendingReferences(Reference.java:265)
	at java.base/java.lang.ref.Reference$ReferenceHandler.run(Reference.java:207)
----------rerun:(47/5429)*----------
Comments
Changeset: c1166a30 Author: Alex Menkov <amenkov@openjdk.org> Date: 2022-10-07 17:13:30 +0000 URL: https://git.openjdk.org/jdk/commit/c1166a304dcff6033b8a37ef944b9efa7ab0608d
07-10-2022

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/10589 Date: 2022-10-06 02:24:12 +0000
06-10-2022

The test verifies Instrumentation.setNativeMethodPrefix functionality instrumenting ALL loaded classes. It uses ASM library, but creates ClassVisitor with ASM7 version, so the visitors cannot handle classes with records (requires ASM8) and permits (requires ASM9) attributes. Accordingly the output the test assumes that returning bad class bytes (empty array) should cause test failure, but this is not correct. java.lang.instrument silently handles errors. So this "Injection failures" produce noice in the test output, but do not cause the test failure. When the test passes, it logs the same "Injection failure" reports. The actual failure reason is ClassCircularityError on "Reference Handler" thread: Exception in thread "Reference Handler" java.lang.ClassCircularityError: java/util/concurrent/locks/AbstractQueuedSynchronizer$ExclusiveNode at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer.tryInitializeHead(AbstractQueuedSynchronizer.java:567) at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer.enqueue(AbstractQueuedSynchronizer.java:582) at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.doSignal(AbstractQueuedSynchronizer.java:1454) at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.signalAll(AbstractQueuedSynchronizer.java:1490) at java.base/java.lang.ref.ReferenceQueue.signal(ReferenceQueue.java:63) at java.base/java.lang.ref.ReferenceQueue.enqueue0(ReferenceQueue.java:106) at java.base/java.lang.ref.ReferenceQueue.enqueue(ReferenceQueue.java:165) at java.base/java.lang.ref.Reference.enqueueFromPending(Reference.java:234) at java.base/java.lang.ref.Reference.processPendingReferences(Reference.java:265) at java.base/java.lang.ref.Reference$ReferenceHandler.run(Reference.java:207) It looks similar to JDK-8284777 (class is the same, but thread is different) Some observations: When the test passes, ExclusiveNode class is loaded before the test starts instrumentation. When the test fails, ExclusiveNode class is instrumented, but log contains reports only from 2 transformers (of 3): failure 1: tr2: Loading com/sun/javatest/regtest/agent/AStatus tr1: Loading com/sun/javatest/regtest/agent/AStatus tr2: Loading java/util/concurrent/locks/AbstractQueuedSynchronizer$ExclusiveNode tr0: Loading com/sun/javatest/regtest/agent/AStatus tr0: Loading java/util/concurrent/locks/AbstractQueuedSynchronizer$ExclusiveNode tr2: Loading java/util/IdentityHashMap$IdentityHashMapIterator tr1: Loading java/util/IdentityHashMap$IdentityHashMapIterator tr0: Loading java/util/IdentityHashMap$IdentityHashMapIterator failure 2: tr2: Loading com/sun/javatest/regtest/agent/AStatus tr1: Loading com/sun/javatest/regtest/agent/AStatus tr0: Loading com/sun/javatest/regtest/agent/AStatus tr1: Loading java/util/concurrent/locks/AbstractQueuedSynchronizer$ExclusiveNode tr0: Loading java/util/concurrent/locks/AbstractQueuedSynchronizer$ExclusiveNode tr2: Loading java/util/IdentityHashMap$IdentityHashMapIterator tr1: Loading java/util/IdentityHashMap$IdentityHashMapIterator tr0: Loading java/util/IdentityHashMap$IdentityHashMapIterator Also the order of transformer calls is inconsistent.
05-10-2022

Added label noreg-self. It seems the classfiles with records require new version ASM8 of the ASM tool used as an injector for class retransformation. Targeting it to 20.
03-07-2022

There's another unresolved issue for the same test: JDK-8284777 Tests fail with java.lang.ClassCircularityError: java/util/concurrent/locks/AbstractQueuedSynchronizer$ExclusiveNode The above failure doesn't mention: ERROR: Injection failure: java.lang.UnsupportedOperationException: Records requires ASM8 but this failure and JDK-8284777 both mention: Exception in thread "Reference Handler" java.lang.ClassCircularityError: java/util/concurrent/locks/AbstractQueuedSynchronizer$ExclusiveNode
01-07-2022