-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
CoreSerializationInGraalITCase of integration test Main fails with latest GraalVM #19338
Comments
/cc @galderz |
I have checked with one of Camel Quarkus extensions using the current serialization support and I can confirm that the test fails in a similar way:
+1. |
`SerializationRegistry` has been moved from `com.oracle.svm.core.jdk.serialize` to `com.oracle.svm.reflect.serialize` in Graal oracle/graal#3050 Closes quarkusio#19338
FWIW one of the issues turns out to be the move of I have also tried invoking the new diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/NativeImageAutoFeatureStep.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/NativeImageAutoFeatureStep.java
index dacefc389d..1026bf027c 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/steps/NativeImageAutoFeatureStep.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/steps/NativeImageAutoFeatureStep.java
@@ -542,6 +542,22 @@ public class NativeImageAutoFeatureStep {
ofMethod(Class.class, "forName", Class.class, String.class, boolean.class, ClassLoader.class),
tc.load("java.lang.Object"), tc.load(false), tccl);
+ AssignableResultHandle serializationRegistryClass = tc.createVariable(Class.class);
+
+ BranchResult graalVm21_3Test = tc.ifGreaterEqualZero(
+ tc.invokeVirtualMethod(VERSION_COMPARE_TO,
+ tc.invokeStaticMethod(VERSION_CURRENT),
+ tc.marshalAsArray(int.class, tc.load(21), tc.load(3))));
+
+ BytecodeCreator greaterThan21_3 = graalVm21_3Test.trueBranch();
+ greaterThan21_3.invokeStaticMethod(
+ ofMethod("org.graalvm.nativeimage.hosted.RuntimeSerialization", "register", void.class, Class.class), clazz);
+ greaterThan21_3.returnValue(null);
+
+ BytecodeCreator notGreaterThan21_3 = graalVm21_3Test.falseBranch();
+ notGreaterThan21_3.assign(serializationRegistryClass,
+ notGreaterThan21_3.loadClass("com.oracle.svm.core.jdk.serialize.SerializationRegistry"));
+
ResultHandle serializationSupport = tc.invokeStaticMethod(
IMAGE_SINGLETONS_LOOKUP,
tc.loadClass("com.oracle.svm.core.jdk.serialize.SerializationRegistry")); Anyone picking this up please let me know if you need any help/heads up. |
FWIW here you can find an example replicating the logic of CoreSerializationInGraalITCase outside of Quarkus using the new API to register the classes for serialization and it appears to work as expected. Note: the pom.xml file uses 21.3.0-SNAPSHOT as the graal version so you will need to run
to install the artifacts from your graal snapshot build. |
`SerializationRegistry` class has been moved from `com.oracle.svm.core.jdk.serialize` to `com.oracle.svm.reflect.serialize` `addReflections` method moved from `com.oracle.svm.reflect.serialize.hosted.SerializationFeature` to `com.oracle.svm.reflect.serialize.hosted.SerializationBuilder` and became `private` See oracle/graal#3050 Note: oracle/graal#3050 also introduces `SerializationFeature.register(Class<?>... classes)` which should be a better alternative to the generated by Quarkus `registerSerializationForClass` method. Closes quarkusio#19338
oracle/graal#3050 introduces a number of changes around the internal APIs that are being used by Quarkus to register classes for serialization thus breaking serialization support when using 21.3-dev These changes are: 1. `SerializationRegistry` class has been moved from `com.oracle.svm.core.jdk.serialize` to `com.oracle.svm.reflect.serialize` 2. `addReflections` method moved from `com.oracle.svm.reflect.serialize.hosted.SerializationFeature` to `com.oracle.svm.reflect.serialize.hosted.SerializationBuilder` and became `private` oracle/graal#3050 also introduces `SerializationFeature.register(Class<?>... classes)` which is available as a public API (not internal) and can save us from having to keep up with the internal APIs as new releases come out. This PR leverages the new API to register classes for serialization when using GraalVM/Mandrel >=21.3. Closes quarkusio#19338
oracle/graal#3050 introduces a number of changes around the internal APIs that are being used by Quarkus to register classes for serialization thus breaking serialization support when using 21.3-dev These changes are: 1. `SerializationRegistry` class has been moved from `com.oracle.svm.core.jdk.serialize` to `com.oracle.svm.reflect.serialize` 2. `addReflections` method moved from `com.oracle.svm.reflect.serialize.hosted.SerializationFeature` to `com.oracle.svm.reflect.serialize.hosted.SerializationBuilder` and became `private` oracle/graal#3050 also introduces `SerializationFeature.register(Class<?>... classes)` which is available as a public API (not internal) and can save us from having to keep up with the internal APIs as new releases come out. This PR leverages the new API to register classes for serialization when using GraalVM/Mandrel >=21.3. Closes quarkusio#19338
oracle/graal#3050 introduces a number of changes around the internal APIs that are being used by Quarkus to register classes for serialization thus breaking serialization support when using 21.3-dev These changes are: 1. `SerializationRegistry` class has been moved from `com.oracle.svm.core.jdk.serialize` to `com.oracle.svm.reflect.serialize` 2. `addReflections` method moved from `com.oracle.svm.reflect.serialize.hosted.SerializationFeature` to `com.oracle.svm.reflect.serialize.hosted.SerializationBuilder` and became `private` oracle/graal#3050 also introduces `SerializationFeature.register(Class<?>... classes)` which is available as a public API (not internal) and can save us from having to keep up with the internal APIs as new releases come out. This PR leverages the new API to register classes for serialization when using GraalVM/Mandrel >=21.3. Closes quarkusio#19338
oracle/graal#3050 introduces a number of changes around the internal APIs that are being used by Quarkus to register classes for serialization thus breaking serialization support when using 21.3-dev These changes are: 1. `SerializationRegistry` class has been moved from `com.oracle.svm.core.jdk.serialize` to `com.oracle.svm.reflect.serialize` 2. `addReflections` method moved from `com.oracle.svm.reflect.serialize.hosted.SerializationFeature` to `com.oracle.svm.reflect.serialize.hosted.SerializationBuilder` and became `private` oracle/graal#3050 also introduces `SerializationFeature.register(Class<?>... classes)` which is available as a public API (not internal) and can save us from having to keep up with the internal APIs as new releases come out. This PR leverages the new API to register classes for serialization when using GraalVM/Mandrel >=21.3. Closes quarkusio#19338 (cherry picked from commit 4921b9f)
Describe the bug
CoreSerializationInGraalITCase of integration test Main fails with latest GraalVM.
See https://github.com/graalvm/mandrel/runs/3296489189?check_suite_focus=true#step:9:440
Expected behavior
Test should pass.
Actual behavior
Test fails with:
How to Reproduce?
jdk.tgz
export GRAALVM_HOME=path/to/extracted/mandrelvm
./mvnw -B --settings .github/mvn-settings.xml --fail-at-end -DfailIfNoTests=false -Dnative -Dnative.surefire.skip -Dformat.skip -Dno-descriptor-tests -DskipDocs -Dquarkus.container-image.build=false -pl integration-tests/main verify
Output of
uname -a
orver
Linux 5.12.15-300.fc34.x86_64 #1 SMP Wed Jul 7 19:46:50 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Output of
java -version
openjdk version "11.0.12" 2021-07-20 OpenJDK Runtime Environment 18.9 (build 11.0.12+7) OpenJDK 64-Bit Server VM 18.9 (build 11.0.12+7, mixed mode, sharing)
GraalVM version (if different from Java)
e3dd4282fe23d2a37fc8b6f2507c86a39d41bb02
Quarkus version or git rev
57d1dae
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d) Maven home: /home/zakkak/.m2/wrapper/dists/apache-maven-3.8.1-bin/2l5mhf2pq2clrde7f7qp1rdt5m/apache-maven-3.8.1 Java version: 11.0.12, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-11-openjdk-11.0.12.0.7-0.fc34.x86_64 Default locale: en_IE, platform encoding: UTF-8 OS name: "linux", version: "5.12.15-300.fc34.x86_64", arch: "amd64", family: "unix"
Additional information
The graal change that brought this up appears to be oracle/graal#3050
I am not sure it's worth digging this further. I think we should adapt Quarkus' serialization support (https://github.com/quarkusio/quarkus/pull/15380/files) to use the new feature instead when using GraalVM >=21.3.
WDYT?
cc @JiriOndrusek
The text was updated successfully, but these errors were encountered: