oracle / graal

GraalVM compiles Java applications into native executables that start instantly, scale fast, and use fewer compute resources 🚀
https://www.graalvm.org
Other
20k stars 1.6k forks source link

[GR-55034] GraalVM compiler reports java.lang.NoSuchMethodError: java.lang.StringCoding.countPositives([BII) #9063

Open xuwang-zuora opened 1 month ago

xuwang-zuora commented 1 month ago

Describe GraalVM and your environment :

Have you verified this issue still happens when using the latest snapshot? You can find snapshot builds here: https://github.com/graalvm/graalvm-ce-dev-builds/releases

Describe the issue Hit Internal GraalVM error, please report at https://github.com/oracle/graal/issues/. when running js using polyglot api.

Code snippet or code repository that reproduces the issue https://github.com/xuwang-zuora/polyglot-bug-report

Steps to reproduce the issue Please include both build steps as well as run steps

  1. git clone --depth 1 https://github.com/xuwang-zuora/polyglot-bug-report
  2. ./mvnw clean package -DskipTests
  3. Import the project to IntelliJ IDEA, then you should be able to see two run configurations
  4. Run DemoAppTest

Expected behavior I expect the unit test should always pass, but the odd thing is, sometime the first run after build works, but if you re-run it several times, it starts to fail and stays that way until another round of mvn clean package.

Additional context Add any other context about the problem here. Specially important are stack traces or log output. Feel free to link to gists or to screenshots if neccesary

org.graalvm.polyglot.PolyglotException: java.lang.AssertionError: Compiler initialization failed cannot continue.
    at com.oracle.truffle.runtime.hotspot.HotSpotTruffleRuntime.bypassedReservedOop(HotSpotTruffleRuntime.java:496)
    at com.oracle.truffle.runtime.hotspot.HotSpotFastThreadLocal.getJVMCIReservedReference(HotSpotFastThreadLocal.java:103)
    at com.oracle.truffle.runtime.hotspot.HotSpotFastThreadLocal.get(HotSpotFastThreadLocal.java:88)
    at com.oracle.truffle.runtime.OptimizedFastThreadLocal.fastGet(OptimizedFastThreadLocal.java:80)
    at com.oracle.truffle.polyglot.PolyglotFastThreadLocals.getContext(PolyglotFastThreadLocals.java:234)
    at com.oracle.truffle.polyglot.PolyglotEngineImpl.leaveCached(PolyglotEngineImpl.java:2113)
    at com.oracle.truffle.polyglot.PolyglotEngineImpl.leave(PolyglotEngineImpl.java:2096)
    at com.oracle.truffle.polyglot.PolyglotEngineImpl.leaveIfNeeded(PolyglotEngineImpl.java:2017)
    at com.oracle.truffle.polyglot.PolyglotValueDispatch.hostLeave(PolyglotValueDispatch.java:1269)
    at com.oracle.truffle.polyglot.PolyglotContextImpl.eval(PolyglotContextImpl.java:1697)
    at com.oracle.truffle.polyglot.PolyglotContextDispatch.eval(PolyglotContextDispatch.java:60)
    at org.graalvm.polyglot.Context.eval(Context.java:402)
    at org.graalvm.polyglot.Context.eval(Context.java:428)
    at com.example.DemoApp.runScript(DemoApp.java:22)
    at com.example.DemoAppTest.testRunScript(DemoAppTest.java:29)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:725)
    at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
    at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
    at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
    at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)
    at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
    at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
    at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
    at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:214)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:210)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:135)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:66)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:107)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
    at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
    at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53)
    at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:57)
    at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
    at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
    at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
    at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:232)
    at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:55)
    Suppressed: Attached Guest Language Frames (0)
Caused by: org.graalvm.compiler.java.BytecodeParser$BytecodeParserError: org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins$InvocationPluginRegistrationError: java.lang.NoSuchMethodError: java.lang.StringCoding.countPositives([BII)
    at parsing org.graalvm.compiler.hotspot.replacements.LoadExceptionObjectSnippets.loadException(LoadExceptionObjectSnippets.java:74)
    at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.throwParserError(BytecodeParser.java:2553)
    at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3434)
    at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.handleBytecodeBlock(BytecodeParser.java:3386)
    at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBlock(BytecodeParser.java:3228)
    at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.build(BytecodeParser.java:1137)
    at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.buildRootMethod(BytecodeParser.java:1029)
    at jdk.internal.vm.compiler/org.graalvm.compiler.java.GraphBuilderPhase$Instance.run(GraphBuilderPhase.java:101)
    at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.run(Phase.java:49)
    at jdk.internal.vm.compiler/org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:434)
    at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:42)
    at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:38)
    at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.ReplacementsImpl$GraphMaker.buildInitialGraph(ReplacementsImpl.java:595)
    at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.ReplacementsImpl$GraphMaker.makeGraph(ReplacementsImpl.java:452)
    at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.ReplacementsImpl.makeGraph(ReplacementsImpl.java:396)
    at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.ReplacementsImpl.getSnippet(ReplacementsImpl.java:298)
    at jdk.internal.vm.compiler/org.graalvm.compiler.hotspot.HotSpotReplacementsImpl.getSnippet(HotSpotReplacementsImpl.java:216)
    at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.SnippetTemplate.<init>(SnippetTemplate.java:1034)
    at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.SnippetTemplate$AbstractTemplates.template(SnippetTemplate.java:961)
    at jdk.internal.vm.compiler/org.graalvm.compiler.hotspot.replacements.LoadExceptionObjectSnippets$Templates.lower(LoadExceptionObjectSnippets.java:112)
    at jdk.internal.vm.compiler/org.graalvm.compiler.hotspot.meta.DefaultHotSpotLoweringProvider.lowerWithoutDelegation(DefaultHotSpotLoweringProvider.java:484)
    at jdk.internal.vm.compiler/org.graalvm.compiler.hotspot.meta.DefaultHotSpotLoweringProvider.lower(DefaultHotSpotLoweringProvider.java:629)
    at jdk.internal.vm.compiler/org.graalvm.compiler.hotspot.amd64.AMD64HotSpotLoweringProvider.lower(AMD64HotSpotLoweringProvider.java:87)
    at jdk.internal.vm.compiler/org.graalvm.compiler.nodes.spi.Lowerable.lower(Lowerable.java:40)
    at jdk.internal.vm.compiler/org.graalvm.compiler.nodes.java.ExceptionObjectNode.lower(ExceptionObjectNode.java:110)
    at jdk.internal.vm.compiler/org.graalvm.compiler.phases.common.LoweringPhase.process(LoweringPhase.java:665)
    at jdk.internal.vm.compiler/org.graalvm.compiler.phases.common.LoweringPhase$ProcessFrame.preprocess(LoweringPhase.java:553)
    at jdk.internal.vm.compiler/org.graalvm.compiler.phases.common.LoweringPhase.processBlock(LoweringPhase.java:764)
    at jdk.internal.vm.compiler/org.graalvm.compiler.phases.common.LoweringPhase.lower(LoweringPhase.java:297)
    at jdk.internal.vm.compiler/org.graalvm.compiler.phases.common.LoweringPhase.run(LoweringPhase.java:271)
    at jdk.internal.vm.compiler/org.graalvm.compiler.phases.common.LoweringPhase.run(LoweringPhase.java:113)
    at jdk.internal.vm.compiler/org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:434)
    at jdk.internal.vm.compiler/org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:322)
    at jdk.internal.vm.compiler/org.graalvm.compiler.phases.PhaseSuite.run(PhaseSuite.java:390)
    at jdk.internal.vm.compiler/org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:434)
    at jdk.internal.vm.compiler/org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:322)
    at jdk.internal.vm.compiler/org.graalvm.compiler.core.GraalCompiler.emitFrontEnd(GraalCompiler.java:304)
    at jdk.internal.vm.compiler/org.graalvm.compiler.core.GraalCompiler.compile(GraalCompiler.java:169)
    at jdk.internal.vm.compiler/org.graalvm.compiler.core.GraalCompiler.compileGraph(GraalCompiler.java:152)
    at jdk.internal.vm.compiler/org.graalvm.compiler.truffle.compiler.hotspot.HotSpotTruffleCompilerImpl.compileTruffleStub(HotSpotTruffleCompilerImpl.java:377)
    at jdk.internal.vm.compiler/org.graalvm.compiler.truffle.compiler.hotspot.HotSpotTruffleCompilerImpl.lambda$installTruffleCallBoundaryMethod$0(HotSpotTruffleCompilerImpl.java:290)
    at jdk.internal.vm.compiler/org.graalvm.compiler.truffle.compiler.hotspot.HotSpotTruffleCompilerImpl.compileAndInstallStub(HotSpotTruffleCompilerImpl.java:335)
    at jdk.internal.vm.compiler/org.graalvm.compiler.truffle.compiler.hotspot.HotSpotTruffleCompilerImpl.installTruffleCallBoundaryMethod(HotSpotTruffleCompilerImpl.java:288)
    at com.oracle.truffle.runtime.hotspot.HotSpotTruffleRuntime.installCallBoundaryMethods(HotSpotTruffleRuntime.java:529)
    at com.oracle.truffle.runtime.hotspot.HotSpotTruffleRuntime.initializeTruffleCompiler(HotSpotTruffleRuntime.java:327)
    at com.oracle.truffle.runtime.hotspot.HotSpotTruffleRuntime$1.accept(HotSpotTruffleRuntime.java:270)
    at com.oracle.truffle.runtime.hotspot.HotSpotTruffleRuntime$1.accept(HotSpotTruffleRuntime.java:266)
    at com.oracle.truffle.runtime.CompilationTask.call(CompilationTask.java:232)
    at com.oracle.truffle.runtime.CompilationTask.call(CompilationTask.java:55)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.lang.Thread.run(Thread.java:840)
    at com.oracle.truffle.runtime.BackgroundCompileQueue$TruffleCompilerThreadFactory$1.run(BackgroundCompileQueue.java:303)
    Suppressed: Attached Guest Language Frames (0)
Caused by: org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins$InvocationPluginRegistrationError: java.lang.NoSuchMethodError: java.lang.StringCoding.countPositives([BII)
    at jdk.internal.vm.compiler/org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins$1.run(InvocationPlugins.java:591)
    at jdk.internal.vm.compiler/org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.flushDeferrables(InvocationPlugins.java:595)
    at jdk.internal.vm.compiler/org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.get(InvocationPlugins.java:483)
    at jdk.internal.vm.compiler/org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.lookupInvocation(InvocationPlugins.java:847)
    at jdk.internal.vm.compiler/org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.lookupInvocation(InvocationPlugins.java:842)
    at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.tryInvocationPlugin(BytecodeParser.java:2230)
    at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.appendInvoke(BytecodeParser.java:1911)
    at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genInvokeStatic(BytecodeParser.java:1691)
    at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genInvokeStatic(BytecodeParser.java:1672)
    at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:5416)
    at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3426)
    ... 51 more
Caused by: java.lang.NoSuchMethodError: java.lang.StringCoding.countPositives([BII)
    at jdk.internal.vm.compiler/org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins$Checks.checkResolvable(InvocationPlugins.java:1061)
    at jdk.internal.vm.compiler/org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.register(InvocationPlugins.java:805)
    at jdk.internal.vm.compiler/org.graalvm.compiler.hotspot.meta.HotSpotInvocationPlugins.register(HotSpotInvocationPlugins.java:96)
    at jdk.internal.vm.compiler/org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins$Registration.register(InvocationPlugins.java:272)
    at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.StandardGraphBuilderPlugins.registerStringCodingPlugins(StandardGraphBuilderPlugins.java:2460)
    at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.StandardGraphBuilderPlugins.registerInvocationPlugins(StandardGraphBuilderPlugins.java:271)
    at jdk.internal.vm.compiler/org.graalvm.compiler.hotspot.meta.HotSpotGraphBuilderPlugins$1.run(HotSpotGraphBuilderPlugins.java:250)
    at jdk.internal.vm.compiler/org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.flushDeferrables(InvocationPlugins.java:574)
    ... 60 more
Internal GraalVM error, please report at https://github.com/oracle/graal/issues/.
selhagani commented 1 month ago

Hi @xuwang-zuora, Thanks for reaching out to us. We'll take a look into this as soon as possible.

selhagani commented 2 weeks ago

I followed the steps provided in your reproducer but encountered a different error when running the command mvn clean package. The error message indicates that the Maven Surefire Plugin failed due to the forked VM terminating unexpectedly.

[ERROR]
[ERROR] Please refer to the individual test results in the surefire-reports directory.
[ERROR] The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was: java -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI --upgrade-module-path=target/graalvm -Xmx512m -jar target/surefire/surefirebooter-20240627152117393_3.jar target/surefire 2024-06-27T15-21-17_353-jvmRun1 surefire-20240627152117393_1tmp surefire_0-20240627152117393_2tmp
[ERROR] Error occurred in starting fork, check output in log
[ERROR] Process Exit Code: 1
[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was: java -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI --upgrade-module-path=target/graalvm -Xmx512m -jar target/surefire/surefirebooter-20240627152117393_3.jar target/surefire 2024-06-27T15-21-17_353-jvmRun1 surefire-20240627152117393_1tmp surefire_0-20240627152117393_2tmp
[ERROR] Error occurred in starting fork, check output in log
[ERROR] Process Exit Code: 1

Can you double check the provided reproducer please?

xuwang-zuora commented 2 weeks ago

@selhagani thanks for responding, I'm not sure which version of maven you're using, what's why I provided the maven wrapper which is pointing to 3.9.7 which is the version I'm using.

You can bypass the test when building by using mvn clean package -DskipTests and then run the unit test DemoAppTest separately, pls be aware that I've already included a run configuration for IntelliJ IDEA, if you're using another IDE, you might need to add additional VM options when running, something like -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI --upgrade-module-path=$PROJECT_DIR$/target/graalvm to enable the compiler for js which I believe you should be familiar with, the path $PROJECT_DIR$/target/graalvm is where depended jar files are downloaded, you should be able to find them after a successful maven build.

dougxc commented 1 week ago

This looks like version mismatch where a JDK version is being used with an incompatible version of Graal. Can you reproduce this on a GraalVM build from https://github.com/graalvm/graalvm-ce-dev-builds/releases?

xuwang-zuora commented 1 week ago

@dougxc could you pls provide some instruction about how to use those dev releases in a maven project?

dougxc commented 1 week ago

I don't know how to do that but @chumer might be able to help you.

xuwang-zuora commented 1 week ago

I didn't get a chance to try the dev build, but I've checked the released 24.0.1, it gave me an error says: Module jdk.graal.compiler does not read a module that exports jdk.vm.ci.services, after added VM option --add-export jdk.vm.ci.services to the argument, the error changed to Module jdk.vm.ci.services not found.

I did some digging, and found https://github.com/oracle/graal/issues/7651#issuecomment-2007941934 which bring me to https://bugs.openjdk.org/browse/JDK-8318027, it seems jdk.vm.ci.services is only available for jdk version higher than 22, so I believe version 24.0.1 is not compatible with jdk 17 which I'm currently using.

Since I can not upgrade the jdk I'm using in the project to 22 which is a not a TLS version, for this particular issue, I need it to be fixed in a JDK 17 compatible version which might be the 23.x.x, latest dev builds won't help on this issue.

dougxc commented 1 week ago

after added VM option --add-export jdk.vm.ci.services to the argument

From java -X:

    --add-exports <module>/<package>=<target-module>(,<target-module>)*
                      updates <module> to export <package> to <target-module>,
                      regardless of module declaration.
                      <target-module> can be ALL-UNNAMED to export to all
                      unnamed modules.

So the correct format is --add-export=jdk.internal.vm.ci/jdk.vm.ci.services=jdk.graal.compiler

You can download GraalVM for JDK 17 at https://www.graalvm.org/downloads.

jchalou commented 1 week ago

You need polyglot version 23.0.4 to work with GraalVM for JDK17 (current version JDK 17.0.11). I can see you have the version 23.1.3 specified in your pom.xml. For that you would need GraalVM for JDK21 (current version JDK 21.0.3).

jchalou commented 1 week ago

Also please note that there were major changes between GraalVM for JDK17 and GraalVM for JDK21. This is explained in the blogpost https://medium.com/graalvm/truffle-unchained-13887b77b62c. Your project seems to be a mixture of the old and the new setup. The old setup is documented here: https://www.graalvm.org/jdk17/reference-manual/embed-languages/