Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashed on normal jdk when native libraries can't load #863

Open
mio-19 opened this issue Oct 12, 2024 · 3 comments
Open

Crashed on normal jdk when native libraries can't load #863

mio-19 opened this issue Oct 12, 2024 · 3 comments
Labels
question Further information is requested

Comments

@mio-19
Copy link

mio-19 commented Oct 12, 2024

My application crashed on a special environment where all so native libraries can't work. Are they required or can graaljs run in interpreter mode without them?

[info] running chester.cli.Main
Exception in thread "sbt-bg-threads-1" java.lang.InternalError: java.lang.UnsatisfiedLinkError: /data/data/com.termux/files/home/.cache/org.graalvm.polyglot/engine/libtruffleattach/7691d960a825b4da63232bbcb65b13e5e4cae68d4e9feb781d82cdfc3892f0d6/bin/libtruffleattach.so: dlopen failed: library "libdl.so.2" not found: needed by /data/data/com.termux/files/home/.cache/org.graalvm.polyglot/engine/libtruffleattach/7691d960a825b4da63232bbcb65b13e5e4cae68d4e9feb781d82cdfc3892f0d6/bin/libtruffleattach.so in namespace (default)
        at com.oracle.truffle.runtime.ModulesSupport.loadModulesSupportLibrary(ModulesSupport.java:170)
        at com.oracle.truffle.runtime.ModulesSupport.<clinit>(ModulesSupport.java:59)
        at com.oracle.truffle.runtime.hotspot.HotSpotTruffleRuntimeAccess.createRuntime(HotSpotTruffleRuntimeAccess.java:84)
        at com.oracle.truffle.runtime.hotspot.HotSpotTruffleRuntimeAccess.getRuntime(HotSpotTruffleRuntimeAccess.java:75)
        at com.oracle.truffle.api.Truffle.createRuntime(Truffle.java:145)
        at com.oracle.truffle.api.Truffle$1.run(Truffle.java:176)
        at com.oracle.truffle.api.Truffle$1.run(Truffle.java:174)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
        at com.oracle.truffle.api.Truffle.initRuntime(Truffle.java:174)
        at com.oracle.truffle.api.Truffle.<clinit>(Truffle.java:63)
        at com.oracle.truffle.runtime.enterprise.EnterpriseTruffle.supportsEnterpriseExtensions(stripped:22)
        at com.oracle.truffle.polyglot.enterprise.EnterprisePolyglotImpl.getPriority(stripped:551)
        at java.base/java.util.Comparator.lambda$comparing$77a9974f$1(Comparator.java:473)
        at java.base/java.util.TimSort.countRunAndMakeAscending(TimSort.java:355)
        at java.base/java.util.TimSort.sort(TimSort.java:220)
        at java.base/java.util.Arrays.sort(Arrays.java:1307)
        at java.base/java.util.ArrayList.sort(ArrayList.java:1721)
        at java.base/java.util.Collections.sort(Collections.java:179)
        at org.graalvm.polyglot.Engine.loadAndValidateProviders(Engine.java:1641)
        at org.graalvm.polyglot.Engine$1.run(Engine.java:1717)
        at org.graalvm.polyglot.Engine$1.run(Engine.java:1712)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
        at org.graalvm.polyglot.Engine.initEngineImpl(Engine.java:1712)
        at org.graalvm.polyglot.Engine$ImplHolder.<clinit>(Engine.java:170)
        at org.graalvm.polyglot.Engine.getImpl(Engine.java:422)
        at org.graalvm.polyglot.Source.getImpl(Source.java:167)
        at org.graalvm.polyglot.Source$Builder.build(Source.java:1027)
        at chester.Js4Jvm$.<clinit>(Js4Jvm.scala:14)
        at chester.cli.PlatformSpecific$.testLoadingJS(PlatformSpecific.scala:9)
        at chester.cli.Main$.main(Main.scala:39)
        at chester.cli.Main.main(Main.scala)
        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 sbt.Run.invokeMain(Run.scala:144)
        at sbt.Run.execute$1(Run.scala:94)
        at sbt.Run.$anonfun$runWithLoader$5(Run.scala:121)
        at sbt.Run$.executeSuccess(Run.scala:187)
        at sbt.Run.runWithLoader(Run.scala:121)
        at sbt.Defaults$.$anonfun$bgRunTask$6(Defaults.scala:2038)
        at sbt.Defaults$.$anonfun$termWrapper$2(Defaults.scala:1977)
        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
        at scala.util.Try$.apply(Try.scala:213)
        at sbt.internal.BackgroundThreadPool$BackgroundRunnable.run(DefaultBackgroundJobService.scala:367)
        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:833)
Caused by: java.lang.UnsatisfiedLinkError: /data/data/com.termux/files/home/.cache/org.graalvm.polyglot/engine/libtruffleattach/7691d960a825b4da63232bbcb65b13e5e4cae68d4e9feb781d82cdfc3892f0d6/bin/libtruffleattach.so: dlopen failed: library "libdl.so.2" not found: needed by /data/data/com.termux/files/home/.cache/org.graalvm.polyglot/engine/libtruffleattach/7691d960a825b4da63232bbcb65b13e5e4cae68d4e9feb781d82cdfc3892f0d6/bin/libtruffleattach.so in namespace (default)
        at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
        at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:384)
        at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:228)
        at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:170)
        at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2389)
        at java.base/java.lang.Runtime.load0(Runtime.java:751)
        at java.base/java.lang.System.load(System.java:1912)
        at com.oracle.truffle.runtime.ModulesSupport.loadModulesSupportLibrary(ModulesSupport.java:167)
        ... 47 more
@woess
Copy link
Member

woess commented Oct 15, 2024

Yes, GraalJS can run in interpreter-only mode using the fallback runtime, by removing the truffle-runtime jars from the module (or class) path.
For that, it's probably enough to just replace the org.graalvm.polyglot:js maven dependency with org.graalvm.js:js-language.

@woess woess added the question Further information is requested label Oct 15, 2024
@mio-19
Copy link
Author

mio-19 commented Oct 15, 2024

Is it possible to auto fallback? I don't want to prepare a special jar or class path for this environment.

@woess
Copy link
Member

woess commented Oct 16, 2024

You can also run with the system property truffle.UseFallbackRuntime set to true, i.e.:
-Dtruffle.UseFallbackRuntime=true.
(You'll probably want to combine it with -Dpolyglot.engine.WarnInterpreterOnly=false.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants