GeezerVison is showing github.com — Native image blocklist violations, Netty 4.2.11/12 regression, Polyglot (JS) · Issue #16607 · netty/netty
Native image blocklist violations, Netty 4.2.11/12 regression, Polyglot (JS) #16607DescriptionProgram based on Vert.x, Netty and using Polyglot (JS). After upgrading from Vert.x from 5.0.8 to 5.0.10 (Netty 4.2.10.Final -> 4.2.12.Final), the build fails with "Blocklist violations", such as:
....
=== Found 7 compilation blocklist violations ===
Blocklisted method
java.lang.invoke.MethodHandle.linkToStatic(Object, Object, int, long, MemberName) (target: java.lang.invoke.MethodHandle.linkToStatic(Object, Object, int, long, MemberName))
trace:
at com.oracle.truffle.js.runtime.array.TypedArray$BigUint64Array.setBufferElementLongImpl(TypedArray.java:1462) [bci: 11]
at com.oracle.truffle.js.runtime.array.TypedArray$TypedBigIntArray.setBufferElement(TypedArray.java:1290) [bci: 14]
at com.oracle.truffle.js.builtins.ArrayPrototypeBuiltins$JSArraySliceNode.sliceGeneric(ArrayPrototypeBuiltins.java:1036) [bci: 347]
at com.oracle.truffle.js.builtins.ArrayPrototypeBuiltinsFactory$JSArraySliceNodeGen.execute(ArrayPrototypeBuiltinsFactory.java:684) [bci: 71]
at com.oracle.truffle.js.builtins.AsyncIteratorPrototypeBuiltins$AsyncIteratorAwaitNode$AsyncIteratorIfAbruptReturnNode.execute(AsyncIteratorPrototypeBuiltins.java:264) [bci: 13]
at com.oracle.truffle.runtime.OptimizedCallTarget.executeRootNode(OptimizedCallTarget.java:830) [bci: 5]
at com.oracle.truffle.runtime.OptimizedCallTarget.profiledPERoot(OptimizedCallTarget.java:754) [bci: 40]
[Root]
java version "25.0.2" 2026-01-20 LTS
Java(TM) SE Runtime Environment Oracle GraalVM 25.0.2+10.1 (build 25.0.2+10-LTS-jvmci-b01)
Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 25.0.2+10.1 (build 25.0.2+10-LTS-jvmci-b01, mixed mode, sharing)
The complete program can be found here: https://github.com/adamdickmeiss/vertx-graalvm-native-image-log4j . FWIW, the actual "bigger" program with the issue is found here: https://github.com/indexdata/reservoir .
I have executed git bisect with a variable Netty in 4.2.11.Final-SNAPSHOT and found that the first failing commit is:
0ee9723
part of:
#16207 Activitychrisvest commented on Apr 10, 2026 Songdoeon commented on Apr 11, 2026 I looked into this.
Cause
PR #16207 removed the UNSAFE_UNAVAILABILITY_CAUSE == null guard from initializeVarHandle():
// Before: Unsafe available → immediate return, VarHandleFactory never loaded
if (UNSAFE_UNAVAILABILITY_CAUSE == null || javaVersion() < 9 || isNativeImage()) {
return false;
}
// After: proceeds further even when Unsafe is available
if (javaVersion() < 9 || isNativeImage()) {
return false;
}
This makes VarHandle-related code reachable during native-image static analysis, even when Unsafe is available.
VarHandle operations (invokeExact(), .get(), .set()) are signature-polymorphic methods that resolve through MethodHandle.linkToStatic, which Truffle's runtime compiler cannot handle triggering the compilation blocklist violations when Polyglot is on the classpath.
Possible fix
Restore the UNSAFE_UNAVAILABILITY_CAUSE == null guard so VarHandle code stays unreachable when Unsafe is available. adamdickmeiss commented on Apr 13, 2026 Tested that modification with the project. Now builds fine. chrisvest commented on Apr 15, 2026
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|