graal icon indicating copy to clipboard operation
graal copied to clipboard

Internal GraalVM Error, on OpenJDK 17 trying to run Python

Open niclash opened this issue 1 year ago • 7 comments

Describe GraalVM and your environment :

  • GraalVM version 23.1.1
  • CE
  • JDK version: OpenJDK 17
  • OS and OS Version: Linux Debian testing
  • Architecture: amd64
  • The output of java -Xinternalversion:
OpenJDK 64-Bit Server VM (17.0.9+9-Debian-1) for linux-amd64 JRE (17.0.9+9-Debian-1), built on Oct 18 2023 09:00:53 by "buildd" with gcc 13.2.0

Have you verified this issue still happens when using the latest snapshot?

I am not yet at a point where I can verify execution outside Unit Tests, and they are driven by Gradle and expects Maven repositories. IF you have SNAPSHOT repositories and not only the zip files, then I can test it, but asking me to make major changes to the build system is a bit too much.

Describe the issue I have testcases for Javascript, Ruby and Python. The JS and Ruby ones works but the Python one fails with the exception below when calling context.getBindings( "python" );

It is quite obviously related to Java Module system and that BouncyCastle isn't modularized. And for similar issues in unrelated libraries, my whole application is not modularized. The solution might lie in some clever module-info magic either in GraalVM jar or in my application. It is not a field that I have much experience.

Code snippet or code repository that reproduces the issue

                Source compiledScript = fetchCompiledScript( language, scriptName, script );
                if( compiledScript == null )
                {
                    return; // nothing to do, if we can't compile it.
                }

                Context context = getContextForOrg( orgId, language );

                Value bindings = context.getPolyglotBindings();
                bindings.putMember( "ts", tsValue );
                bindings = context.getBindings( language );
                bindings.putMember( "ts", tsValue );
                Value v = context.eval( compiledScript );
                result[0] = interpretOutput( orgId, key, tsValue, v );

import polyglot

ts = polyglot.import_value('ts')

if ts.value > 100:
    result = '{"type": "alarm", "state":"on", "name":"' + ts.name + '","tsvalue":"' + str(
        ts.value) + '","message": "Value exceeding 100."}'
else:
    result = '{"type": "alarm", "state":"off", "name":"' + ts.name + '","tsvalue":"' + str(
        ts.value) + '","message": "Value below 100."}'
result

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

  1. Step one [e.g.: git clone --depth 1 https://git.myrepo.com/projectone ]
  2. Step two [e.g.: mvn clean package]

Expected behavior A clear and concise description of what you expected to happen.

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 necesary

Details
org.graalvm.polyglot.PolyglotException: java.lang.IllegalAccessError: class org.bouncycastle.jce.provider.BouncyCastleProvider (in module org.bouncycastle.provider) cannot access class java.util.logging.Logger (in module java.logging) because module org.bouncycastle.provider does not read module java.logging
	at org.bouncycastle.provider/org.bouncycastle.jce.provider.BouncyCastleProvider.<clinit>(BouncyCastleProvider.java:75)
	at org.graalvm.py/com.oracle.graal.python.builtins.objects.ssl.CertUtils.<clinit>(CertUtils.java:118)
	at org.graalvm.py/com.oracle.graal.python.builtins.modules.hashlib.HashlibModuleBuiltins.<clinit>(HashlibModuleBuiltins.java:141)
	at org.graalvm.py/com.oracle.graal.python.builtins.Python3Core.initializeBuiltins(Python3Core.java:639)
	at org.graalvm.py/com.oracle.graal.python.builtins.Python3Core.<init>(Python3Core.java:783)
	at org.graalvm.py/com.oracle.graal.python.runtime.PythonContext.<init>(PythonContext.java:1109)
	at org.graalvm.py/com.oracle.graal.python.PythonLanguage.createContext(PythonLanguage.java:410)
	at org.graalvm.py/com.oracle.graal.python.PythonLanguage.createContext(PythonLanguage.java:134)
	at org.graalvm.truffle/com.oracle.truffle.api.LanguageAccessor$LanguageImpl.createEnvContext(LanguageAccessor.java:270)
	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotLanguageContext.ensureCreated(PolyglotLanguageContext.java:652)
	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotLanguageContext.ensureInitialized(PolyglotLanguageContext.java:731)
	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotContextImpl.getBindings(PolyglotContextImpl.java:1402)
	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotContextDispatch.getBindings(PolyglotContextDispatch.java:95)
	at org.graalvm.polyglot.impl.UnnamedToModuleContextDispatchGen.getBindings(UnnamedToModuleContextDispatchGen.java:89)
	at org.graalvm.polyglot.Context.getBindings(Context.java:563)
	at com.sensetif.pipes.fx.conditions.ConditionExecutor.lambda$executeConditionScripts$2(ConditionExecutor.java:227)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
	at java.base/java.util.Collections$UnmodifiableMap$UnmodifiableEntrySet.lambda$entryConsumer$0(Collections.java:1625)
	at java.base/java.util.HashMap$EntrySpliterator.forEachRemaining(HashMap.java:1850)
	at java.base/java.util.Collections$UnmodifiableMap$UnmodifiableEntrySet$UnmodifiableEntrySetSpliterator.forEachRemaining(Collections.java:1650)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
	at com.sensetif.cassandra.model.mock.MockKeyValues.select(MockKeyValues.java:29)
	at com.sensetif.pipes.fx.conditions.ConditionExecutor.executeConditionScripts(ConditionExecutor.java:204)
	at com.sensetif.pipes.fx.conditions.ConditionExecutor.lambda$apply$1(ConditionExecutor.java:176)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
	at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
	at com.sensetif.cassandra.model.mock.MockDatapoints.select(MockDatapoints.java:56)
	at com.sensetif.pipes.fx.conditions.ConditionExecutor.apply(ConditionExecutor.java:169)
	at com.sensetif.pipes.fx.conditions.ConditionExecutor.apply(ConditionExecutor.java:58)
	at com.sensetif.pipes.fx.PipeMultiResultFunction.handleMessage(PipeMultiResultFunction.java:21)
	at com.sensetif.pipes.fx.PipeFunction.messageReceived(PipeFunction.java:98)
	at com.sensetif.pipes.messaging.TestMessenger$Subscription.receiveAll(TestMessenger.java:166)
	at java.base/java.util.concurrent.CopyOnWriteArrayList.forEach(CopyOnWriteArrayList.java:807)
	at com.sensetif.pipes.messaging.TestMessenger$ConsumerThread.run(TestMessenger.java:198)
	at java.base/java.lang.Thread.run(Thread.java:840)
	Suppressed: Attached Guest Language Frames (0)
Internal GraalVM error, please report at https://github.com/oracle/graal/issues/.
}

niclash avatar Nov 07 '23 12:11 niclash

Hi @niclash we will be looking into this. Thank you.

selhagani avatar Nov 07 '23 16:11 selhagani

Hi @niclash I don't have access to the repo you provided for me to clone.

selhagani avatar Nov 15 '23 14:11 selhagani

I didn't provide a repository.

niclash avatar Nov 15 '23 14:11 niclash

I will try and make a dedicated repo and see if the problem can be simplified.

niclash avatar Nov 15 '23 15:11 niclash

https://github.com/niclash/graaltest

./gradlew clean test

and you should get

org.graalvm.polyglot.PolyglotException: java.lang.IllegalAccessError: class org.bouncycastle.jce.provider.BouncyCastleProvider (in module org.bouncycastle.provider) cannot access class java.util.logging.Logger (in module java.logging) because module org.bouncycastle.provider does not read module java.logging
	at org.bouncycastle.provider/org.bouncycastle.jce.provider.BouncyCastleProvider.<clinit>(BouncyCastleProvider.java:75)
	at org.graalvm.py/com.oracle.graal.python.builtins.objects.ssl.CertUtils.<clinit>(CertUtils.java:118)
	at org.graalvm.py/com.oracle.graal.python.builtins.modules.hashlib.HashlibModuleBuiltins.<clinit>(HashlibModuleBuiltins.java:141)
	at org.graalvm.py/com.oracle.graal.python.builtins.Python3Core.initializeBuiltins(Python3Core.java:639)
	at org.graalvm.py/com.oracle.graal.python.builtins.Python3Core.<init>(Python3Core.java:783)
	at org.graalvm.py/com.oracle.graal.python.runtime.PythonContext.<init>(PythonContext.java:1109)
	at org.graalvm.py/com.oracle.graal.python.PythonLanguage.createContext(PythonLanguage.java:410)
	at org.graalvm.py/com.oracle.graal.python.PythonLanguage.createContext(PythonLanguage.java:134)
	at org.graalvm.truffle/com.oracle.truffle.api.LanguageAccessor$LanguageImpl.createEnvContext(LanguageAccessor.java:270)
	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotLanguageContext.ensureCreated(PolyglotLanguageContext.java:652)
	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotLanguageContext.ensureInitialized(PolyglotLanguageContext.java:731)
	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotContextImpl.eval(PolyglotContextImpl.java:1682)
	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotContextDispatch.eval(PolyglotContextDispatch.java:60)
	at app//org.graalvm.polyglot.impl.UnnamedToModuleContextDispatchGen.eval(UnnamedToModuleContextDispatchGen.java:61)
	at app//org.graalvm.polyglot.Context.eval(Context.java:402)
	at app//org.hedhman.niclas.GraalTest.testPython(GraalTest.java:17)
	at [email protected]/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at [email protected]/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at [email protected]/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at [email protected]/java.lang.reflect.Method.invoke(Method.java:568)
	at app//org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:727)
	at app//org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
	at app//org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
	at app//org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:156)
	at app//org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:147)
	at app//org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:86)
	at app//org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:103)
	at app//org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93)
	at app//org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
	at app//org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
	at app//org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
	at app//org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
	at app//org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:92)
	at app//org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:86)
	at app//org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:217)
	at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at app//org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:213)
	at app//org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:138)
	at app//org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:68)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
	at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at app//org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at [email protected]/java.util.ArrayList.forEach(ArrayList.java:1511)
	at app//org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
	at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at app//org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at [email protected]/java.util.ArrayList.forEach(ArrayList.java:1511)
	at app//org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
	at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at app//org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at app//org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
	at app//org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
	at app//org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
	at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:107)
	at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
	at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
	at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
	at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
	at app//org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
	at app//org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
	at app//org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.processAllTestClasses(JUnitPlatformTestClassProcessor.java:110)
	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.access$000(JUnitPlatformTestClassProcessor.java:90)
	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.stop(JUnitPlatformTestClassProcessor.java:85)
	at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:62)
	at [email protected]/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at [email protected]/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at [email protected]/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at [email protected]/java.lang.reflect.Method.invoke(Method.java:568)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
	at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
	at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
	at jdk.proxy1/jdk.proxy1.$Proxy2.stop(Unknown Source)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker$3.run(TestWorker.java:193)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60)
	at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)
	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:113)
	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:65)
	at app//worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69)
	at app//worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)

niclash avatar Nov 15 '23 15:11 niclash

https://github.com/niclash/graaltest is not accessible

selhagani avatar Nov 15 '23 15:11 selhagani

Sorry, didn't notice that "private" was default. https://github.com/niclash/graaltest.git

niclash avatar Nov 15 '23 15:11 niclash