JDK-8195731 : [Graal] runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformSuperSubTwoPckgs.java intermittently fails with Graal JIT
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 10,11
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2018-01-18
  • Updated: 2019-09-13
  • Resolved: 2018-02-05
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 11
11 b01Fixed
Related Reports
Relates :  
Description
runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformSuperSubTwoPckgs.java intermittently fails when running in Graal as JIT compiler mode. 

The error is:
java.lang.RuntimeException: 'parent-transform-check: this-has-been--transformed' missing from stdout/stderr 

	at jdk.test.lib.process.OutputAnalyzer.shouldContain(OutputAnalyzer.java:135)
	at TransformTestCommon.checkTransformationResults(TransformTestCommon.java:53)
	at TransformTestCommon.checkResults(TransformTestCommon.java:112)
	at TransformRelatedClasses.runTest(TransformRelatedClasses.java:168)
	at TransformRelatedClasses.main(TransformRelatedClasses.java:116)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:115)
	at java.base/java.lang.Thread.run(Thread.java:844)
 
Comments
Okay, I'll send the corresponding changeset for review.
01-02-2018

if we believe that SVM will fix it, I'm fine w/ temporal exclusion of this test from graal testing.
31-01-2018

The problem is that JVMCI initialization (or Graal compilation) is triggered in SimpleTransformer::transform() which then triggers class loading of the to-be-transformed class, resulting in a ClassCircularityError (see JDK-8164165) which is ignored. Most transformations fail, including the expected transformation of the test classes. We should add code that catches exceptions and reports them similar to what we do in runtime/RedefineTests/RedefineAnnotations.java: http://cr.openjdk.java.net/~thartmann/8195731/webrev.00/ The log of a failing run then looks like this: TransformerAgent: SimpleTransformer called for: sun/invoke/util/Wrapper$1@1 [...] java.lang.ClassCircularityError: sun/invoke/util/Wrapper$1 at java.base/sun.invoke.util.Wrapper.zero(Wrapper.java:230) at java.base/java.lang.invoke.LambdaForm.createFormsFor(LambdaForm.java:1785) at java.base/java.lang.invoke.LambdaForm.identityForm(LambdaForm.java:1698) at java.base/java.lang.invoke.MethodHandles.makeIdentity(MethodHandles.java:3414) at java.base/java.lang.invoke.MethodHandles.identity(MethodHandles.java:3356) at java.base/java.lang.invoke.MethodHandles.constant(MethodHandles.java:3339) at java.base/java.lang.invoke.InnerClassLambdaMetafactory.buildCallSite(InnerClassLambdaMetafactory.java:210) at java.base/java.lang.invoke.LambdaMetafactory.metafactory(LambdaMetafactory.java:317) at java.base/java.lang.invoke.CallSite.makeSite(CallSite.java:330) at java.base/java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:250) at java.base/java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:240) at java.base/java.util.regex.Pattern.DOT(Pattern.java:5734) at java.base/java.util.regex.Pattern.sequence(Pattern.java:2169) at java.base/java.util.regex.Pattern.expr(Pattern.java:2050) at java.base/java.util.regex.Pattern.compile(Pattern.java:1772) at java.base/java.util.regex.Pattern.<init>(Pattern.java:1421) at java.base/java.util.regex.Pattern.compile(Pattern.java:1071) at java.base/java.util.regex.Pattern.matches(Pattern.java:1176) at java.base/java.lang.String.matches(String.java:2023) at TransformerAgent$SimpleTransformer.shouldTransform(TransformerAgent.java:84) at TransformerAgent$SimpleTransformer.transform(TransformerAgent.java:64) at java.instrument/java.lang.instrument.ClassFileTransformer.transform(ClassFileTransformer.java:246) at java.instrument/sun.instrument.TransformerManager.transform(TransformerManager.java:188) at java.instrument/sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:560) at java.base/sun.invoke.util.Wrapper.zero(Wrapper.java:230) at java.base/java.lang.invoke.LambdaForm.createFormsFor(LambdaForm.java:1785) at java.base/java.lang.invoke.LambdaForm.identityForm(LambdaForm.java:1698) at java.base/java.lang.invoke.MethodHandles.makeIdentity(MethodHandles.java:3414) at java.base/java.lang.invoke.MethodHandles.identity(MethodHandles.java:3356) at java.base/java.lang.invoke.MethodHandles.constant(MethodHandles.java:3339) at java.base/java.lang.invoke.InnerClassLambdaMetafactory.buildCallSite(InnerClassLambdaMetafactory.java:210) at java.base/java.lang.invoke.LambdaMetafactory.metafactory(LambdaMetafactory.java:317) at java.base/java.lang.invoke.CallSite.makeSite(CallSite.java:330) at java.base/java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:250) at java.base/java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:240) at java.base/java.lang.reflect.Proxy.getProxyConstructor(Proxy.java:413) at java.base/java.lang.reflect.Proxy.newProxyInstance(Proxy.java:999) at java.base/sun.reflect.annotation.AnnotationParser$1.run(AnnotationParser.java:305) at java.base/sun.reflect.annotation.AnnotationParser$1.run(AnnotationParser.java:303) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/sun.reflect.annotation.AnnotationParser.annotationForMap(AnnotationParser.java:303) at java.base/sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:293) at java.base/sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120) at java.base/sun.reflect.annotation.AnnotationParser.parseSelectAnnotations(AnnotationParser.java:101) at java.base/sun.reflect.annotation.AnnotationType.<init>(AnnotationType.java:145) at java.base/sun.reflect.annotation.AnnotationType.getInstance(AnnotationType.java:85) at java.base/sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:266) at java.base/sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120) at java.base/sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72) at java.base/java.lang.reflect.Executable.declaredAnnotations(Executable.java:605) at java.base/java.lang.reflect.Executable.declaredAnnotations(Executable.java:603) at java.base/java.lang.reflect.Executable.getAnnotation(Executable.java:573) at java.base/java.lang.reflect.Method.getAnnotation(Method.java:693) at java.base/java.lang.reflect.AnnotatedElement.isAnnotationPresent(AnnotatedElement.java:274) at java.base/java.lang.reflect.AccessibleObject.isAnnotationPresent(AccessibleObject.java:514) at java.base/jdk.internal.reflect.Reflection.isCallerSensitive(Reflection.java:312) at java.base/jdk.internal.reflect.ReflectionFactory.newMethodAccessor(ReflectionFactory.java:182) at java.base/java.lang.reflect.Method.acquireMethodAccessor(Method.java:630) at java.base/java.lang.reflect.Method.invoke(Method.java:562) at jdk.internal.vm.ci/jdk.vm.ci.services.internal.ReflectionAccessJDK.openJVMCITo(ReflectionAccessJDK.java:71) at jdk.internal.vm.ci/jdk.vm.ci.services.JVMCIServiceLocator.<init>(JVMCIServiceLocator.java:64) at jdk.internal.vm.compiler@10-internal/org.graalvm.compiler.hotspot.HotSpotGraalJVMCIServiceLocator.<init>(HotSpotGraalJVMCIServiceLocator.java:32) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488) at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:779) at java.base/java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:721) at java.base/java.util.ServiceLoader$3.next(ServiceLoader.java:1394) at jdk.internal.vm.ci/jdk.vm.ci.services.JVMCIServiceLocator.getProviders(JVMCIServiceLocator.java:87) at jdk.internal.vm.ci/jdk.vm.ci.hotspot.HotSpotJVMCICompilerConfig.getCompilerFactory(HotSpotJVMCICompilerConfig.java:79) at jdk.internal.vm.ci/jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.<init>(HotSpotJVMCIRuntime.java:290) at jdk.internal.vm.ci/jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.<init>(HotSpotJVMCIRuntime.java:65) at jdk.internal.vm.ci/jdk.vm.ci.hotspot.HotSpotJVMCIRuntime$DelayedInit.<clinit>(HotSpotJVMCIRuntime.java:73) at jdk.internal.vm.ci/jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime(HotSpotJVMCIRuntime.java:83) at jdk.internal.vm.ci/jdk.vm.ci.runtime.JVMCI.initializeRuntime(Native Method) at jdk.internal.vm.ci/jdk.vm.ci.runtime.JVMCI.<clinit>(JVMCI.java:58) These tests were added by JDK-8078644. [~jiangli], what do you think? To avoid such failures, we should probably not execute tests that transform classes with Graal. But then again, this may cause problems in user code as well. [~iignatyev], [~epavlova], any thoughts? EDIT: Doug pointed out that Substrate VM will fix this, so adding "@requires !vm.graal.enabled" to these tests should be fine for now.
31-01-2018

The problem seems to be that with Graal as JIT the TransformerAgent does not recognize the to be transformed class: TransformerAgent: SimpleTransformer called for: myPkg2/SubClass@1 TransformerAgent: SimpleTransformer called for: java/util/stream/Collectors$CollectorImpl@1 Correct output should look like: TransformerAgent: SimpleTransformer called for: myPkg2/SubClass@1 TransformerAgent: shouldTransform: match-found, match = myPkg2.SubClass TransformerAgent: transforming: class name = myPkg2/SubClass ILW = Class transformation fails, single test with Graal as JIT, use C2 = HLM = P3
29-01-2018

Steps to reproduce: > jtreg -timeout:5 -vt -k:\!ignore -jdk:jdk10_fastdebug -dir:test/hotspot/jtreg -javaoptions:"-XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+TieredCompilation -XX:+UseJVMCICompiler -Djvmci.Compiler=graal" runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformSuperSubTwoPckgs.java I can reproduce it every 10th time.
18-01-2018