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
Premature initialization of SVM encodings #8795
Comments
Thanks for reporting this. I will take a look at it |
- chore: release bump → `1.0.0-alpha8` - chore: issue new packaging and install script versions - chore: doc for issue with gvm/ruby - chore: readme updates; language compat, new versions - chore: use short test names in console reporting - chore: rebuild docs - chore: fix slsa provenance - chore: strict ci hardening Fixes and closes #789 Relates-To: oracle/graal#8795 Signed-off-by: Sam Gammon <sam@elide.ventures>
This specific code changed on master, compare graal/truffle/src/com.oracle.truffle.api.strings/src/com/oracle/truffle/api/strings/JCodings.java Line 143 in c0959ee
Could you try with master too? |
- chore: release bump → `1.0.0-alpha8` - chore: issue new packaging and install script versions - chore: doc for issue with gvm/ruby - chore: readme updates; language compat, new versions - chore: use short test names in console reporting - chore: rebuild docs - chore: fix slsa provenance - chore: strict ci hardening Fixes and closes #789 Relates-To: oracle/graal#8795 Signed-off-by: Sam Gammon <sam@elide.ventures>
Prepares the `alpha8` release of Elide. - feat: extended language tooling - feat(dev): add support for rust - feat(dev): add new `graalvm-ts` module for typescript - feat(model): model for dependencies in project config - feat(model): model for tooling configurations and support - feat(node): node native std module structures - feat(node): implement `path` module - feat(node): implement `process` module - fix: build deprecations, ability to override kotlin + jvm targets - fix: detect `Throwable` instances as provided to logging calls - fix: generate stacktrace and include in place of exception - fix: ci audit for build, unused imports/fmt - fix: version alignment for netty and kotlin - fix(cli): duplicate print with commands via repl - fix(cli): language selector logic - fix(cli): missing libffi dependency - fix(cli): static native library registration - fix(cli): jline output style - fix(cli): support for `elide srcfile.<js|py|rb>` - fix(cli): language/action selection from root entrypoint - fix(cli): ability to detect language by file extension - fix(cli): command prefix should override language selection - fix(dev): detekt version and conventions - fix(js): cis and esm imports - fix(js): js bindings in newer testing framework - fix(js): latest language declaration for `ES2023` - fix(vfs): short-read bug in vfs layer - fix(vfs): vfs access during testing - chore: release bump → `1.0.0-alpha8` - chore: issue new packaging and install script versions - chore: doc for issue with gvm/ruby - chore: readme updates; language compat, new versions - chore: use short test names in console reporting - chore: rebuild docs - chore: fix slsa provenance - chore: strict ci hardening - chore: update pgo profiles - chore: remove superfluous deps from native image - chore: enable embedded sbom - chore: enable pgo - chore: enable context pre-init (non-experimental) - chore(model): language support updates to embedded vm info - chore(tooling): add `pkl` module - chore(tooling): add `esbuild` module - chore(tooling): add `ruff` module - chore(tooling): add `uv` module - chore(tooling): add third_party root - chore(cli): re-enable native lib features - chore(cli): add `umbrella` native lib for tooling bridge - chore(cli): add new `cli-bridge` module for JNI access to umbrella lib - chore(js): recompile polyfills and runtime facade - chore(js): cleanup old experimental esbuild entry point Fixes and closes #789 Fixes and closes #210 Relates-To: oracle/graal#8795 Signed-off-by: Sam Gammon <sam@elide.ventures>
Prepares the `alpha8` release of Elide. - feat: extended language tooling - feat(dev): add support for rust - feat(dev): add new `graalvm-ts` module for typescript - feat(model): model for dependencies in project config - feat(model): model for tooling configurations and support - feat(node): node native std module structures - feat(node): implement `path` module - feat(node): implement `process` module - fix: build deprecations, ability to override kotlin + jvm targets - fix: detect `Throwable` instances as provided to logging calls - fix: generate stacktrace and include in place of exception - fix: ci audit for build, unused imports/fmt - fix: version alignment for netty and kotlin - fix(cli): duplicate print with commands via repl - fix(cli): language selector logic - fix(cli): missing libffi dependency - fix(cli): static native library registration - fix(cli): jline output style - fix(cli): support for `elide srcfile.<js|py|rb>` - fix(cli): language/action selection from root entrypoint - fix(cli): ability to detect language by file extension - fix(cli): command prefix should override language selection - fix(dev): detekt version and conventions - fix(js): cis and esm imports - fix(js): js bindings in newer testing framework - fix(js): latest language declaration for `ES2023` - fix(vfs): short-read bug in vfs layer - fix(vfs): vfs access during testing - chore: release bump → `1.0.0-alpha8` - chore: issue new packaging and install script versions - chore: doc for issue with gvm/ruby - chore: readme updates; language compat, new versions - chore: use short test names in console reporting - chore: rebuild docs - chore: fix slsa provenance - chore: strict ci hardening - chore: update pgo profiles - chore: remove superfluous deps from native image - chore: enable embedded sbom - chore: enable pgo - chore: enable context pre-init (non-experimental) - chore(model): language support updates to embedded vm info - chore(tooling): add `pkl` module - chore(tooling): add `esbuild` module - chore(tooling): add `ruff` module - chore(tooling): add `uv` module - chore(tooling): add third_party root - chore(cli): re-enable native lib features - chore(cli): add `umbrella` native lib for tooling bridge - chore(cli): add new `cli-bridge` module for JNI access to umbrella lib - chore(js): recompile polyfills and runtime facade - chore(js): cleanup old experimental esbuild entry point Fixes and closes #789 Fixes and closes #210 Relates-To: oracle/graal#8795 Signed-off-by: Sam Gammon <sam@elide.ventures>
Describe the issue
When building a Truffle-enabled
native-image
with a certain combination ofFeature
implementations on the classpath, initialization of registered encodings forTruffleString
may occur before the full suite of Truffle languages has loaded; this causes an invalid state which causes TruffleRuby to crash later, at runtime.Truffle decides whether to enable
JCodings
based on a simple condition:graal/truffle/src/com.oracle.truffle.api.strings/src/com/oracle/truffle/api/strings/JCodings.java
Line 60 in 407ca89
TStringAccessor
delegates to the engine:graal/truffle/src/com.oracle.truffle.api.strings/src/com/oracle/truffle/api/strings/TStringAccessor.java
Lines 66 to 68 in 407ca89
Which delegates to
EngineAccessor
:graal/truffle/src/com.oracle.truffle.polyglot/src/com/oracle/truffle/polyglot/EngineAccessor.java
Lines 1982 to 1985 in 407ca89
Which ultimately calls into the
LanguageCache
:graal/truffle/src/com.oracle.truffle.polyglot/src/com/oracle/truffle/polyglot/LanguageCache.java
Lines 214 to 220 in 407ca89
... which then queries the registered Truffle languages to determine if all codings are needed.
However, at this stage of execution, it is not guaranteed that Truffle languages have loaded yet via
TruffleBaseFeature
:graal/substratevm/src/com.oracle.svm.truffle/src/com/oracle/svm/truffle/TruffleBaseFeature.java
Lines 247 to 255 in 407ca89
TruffleRuby at latest release happens to depend on all encodings. As a result, the
native-image
created under these conditions either breaks immediately at runtime, with:... or at build time with the same exception, if
--initialize-at-build-time=org.truffleruby.core.encoding.Encodings
is passed.Steps to reproduce the issue
In our case (Elide), we are building against latest (
24.0.1
)native-image
, with GraalPython, TruffleRuby, and GraalJs.GraalPython triggers the early initialization of
TruffleString
encodings via a handful of calls in theBouncyCastleFeature
andJNIFeature
classes. In both cases, there are checks againstPythonOptions
static fields; for example here. It is the class initialization ofPythonOptions
which initializes encodings withTruffleString
literals used at class-init time.git clone git@github.com:elide-dev/elide.git -b main
cd elide && ./gradlew build -x test -x check
vim ./packages/cli/build.gradle.kts
enableRuby
totrue
./gradlew :packages:cli:nativeCompile
./packages/cli/build/native/nativeCompile/elide.debug shell --language=RUBY
Describe GraalVM and your environment:
24.0.1
22.0.1
14.3.1
The text was updated successfully, but these errors were encountered: