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

Multiple -H:+UnlockExperimentalVMOptions and -H:-UnlockExperimentalVMOptions used when invoking native-image in the image build #40555

Closed
gastaldi opened this issue May 10, 2024 · 3 comments
Labels
area/native-image kind/bug Something isn't working

Comments

@gastaldi
Copy link
Contributor

Describe the bug

When building a Quarkus project to native, I noticed that the native-image command contains multiple -H:+UnlockExperimentalVMOptions and -H:-UnlockExperimentalVMOptions, which I believe are exclusive to each other.

Here is the output:

GraalVM installed locally

$ mvn clean package -Dnative

[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildRunner] /Users/ggastald/.sdkman/candidates/java/21.0.2-graalce/bin/native-image -J-DCoordinatorEnvironmentBean.transactionStatusManagerEnable=false -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dlogging.initial-configurator.min-level=500 -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=3 -J-Duser.language=en -J-Duser.country=BR -J-Dfile.encoding=UTF-8 --features=io.quarkus.caffeine.runtime.graal.CacheConstructorsFeature,io.quarkus.runner.Feature,io.quarkus.hibernate.orm.runtime.graal.DisableLoggingFeature,org.hibernate.graalvm.internal.GraalVMStaticFeature,io.quarkus.runtime.graal.DisableLoggingFeature -J--add-exports=java.security.jgss/sun.security.krb5=ALL-UNNAMED -J--add-opens=java.base/java.text=ALL-UNNAMED -J--add-opens=java.base/java.io=ALL-UNNAMED -J--add-opens=java.base/java.lang.invoke=ALL-UNNAMED -J--add-opens=java.base/java.util=ALL-UNNAMED -H:+UnlockExperimentalVMOptions -H:BuildOutputJSONFile=flyawy-sqlserver-native-reproducer-1.0.0-SNAPSHOT-runner-build-output-stats.json -H:-UnlockExperimentalVMOptions --strict-image-heap -H:+UnlockExperimentalVMOptions -H:+AllowFoldMethods -H:-UnlockExperimentalVMOptions -J-Djava.awt.headless=true --no-fallback --link-at-build-time -H:+UnlockExperimentalVMOptions -H:+ReportExceptionStackTraces -H:-UnlockExperimentalVMOptions -H:+AddAllCharsets --enable-url-protocols=http,https --enable-monitoring=heapdump -H:+UnlockExperimentalVMOptions -H:-UseServiceLoaderFeature -H:-UnlockExperimentalVMOptions -J--add-exports=org.graalvm.nativeimage/org.graalvm.nativeimage.impl=ALL-UNNAMED --exclude-config io\.netty\.netty-codec /META-INF/native-image/io\.netty/netty-codec/generated/handlers/reflect-config\.json --exclude-config io\.netty\.netty-handler /META-INF/native-image/io\.netty/netty-handler/generated/handlers/reflect-config\.json flyawy-sqlserver-native-reproducer-1.0.0-SNAPSHOT-runner -jar flyawy-sqlserver-native-reproducer-1.0.0-SNAPSHOT-runner.jar

Building from a Docker Container

$ mvn -Pnative clean package -Dquarkus.native.container-build=true -Dquarkus.native.builder-image=quay.io/quarkus/ubi-quarkus-mandrel-builder-image:jdk-22

[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildRunner] docker run --env LANG=C --rm --user 501:20 -v /private/tmp/flyawy-sqlserver-native-reproducer/target/flyawy-sqlserver-native-reproducer-1.0.0-SNAPSHOT-native-image-source-jar:/project:z--name build-native-OxbFC quay.io/quarkus/ubi-quarkus-mandrel-builder-image:jdk-22 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dlogging.initial-configurator.min-level=500 -J-DCoordinatorEnvironmentBean.transactionStatusManagerEnable=false -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=3 -J-Duser.language=en -J-Duser.country=BR -J-Dfile.encoding=UTF-8 --features=io.quarkus.runner.Feature,io.quarkus.runtime.graal.DisableLoggingFeature,org.hibernate.graalvm.internal.GraalVMStaticFeature,io.quarkus.hibernate.orm.runtime.graal.DisableLoggingFeature,io.quarkus.caffeine.runtime.graal.CacheConstructorsFeature -J--add-exports=java.security.jgss/sun.security.krb5=ALL-UNNAMED -J--add-opens=java.base/java.text=ALL-UNNAMED -J--add-opens=java.base/java.io=ALL-UNNAMED -J--add-opens=java.base/java.lang.invoke=ALL-UNNAMED -J--add-opens=java.base/java.util=ALL-UNNAMED -H:+UnlockExperimentalVMOptions -H:BuildOutputJSONFile=flyawy-sqlserver-native-reproducer-1.0.0-SNAPSHOT-runner-build-output-stats.json -H:-UnlockExperimentalVMOptions-H:+UnlockExperimentalVMOptions -H:+AllowFoldMethods -H:-UnlockExperimentalVMOptions -J-Djava.awt.headless=true --no-fallback --link-at-build-time -H:+UnlockExperimentalVMOptions -H:+ReportExceptionStackTraces -H:-UnlockExperimentalVMOptions -H:+AddAllCharsets --enable-url-protocols=http,https --enable-monitoring=heapdump -H:+UnlockExperimentalVMOptions -H:-UseServiceLoaderFeature -H:-UnlockExperimentalVMOptions -J--add-exports=org.graalvm.nativeimage/org.graalvm.nativeimage.impl=ALL-UNNAMED --exclude-config io\.netty\.netty-codec /META-INF/native-image/io\.netty/netty-codec/generated/handlers/reflect-config\.json --exclude-config io\.netty\.netty-handler /META-INF/native-image/io\.netty/netty-handler/generated/handlers/reflect-config\.json flyawy-sqlserver-native-reproducer-1.0.0-SNAPSHOT-runner -jar flyawy-sqlserver-native-reproducer-1.0.0-SNAPSHOT-runner.jar

Expected behavior

Only -H:+UnlockExperimentalVMOptions is specified or nothing at all if no experimental VM options are set

Actual behavior

Several -H:+UnlockExperimentalVMOptions and -H:-UnlockExperimentalVMOptions in the native-image invocation.

How to Reproduce?

  1. Generate a Quarkus project (using code.quarkus.io or the CLI) using the quarkus-rest-jsonb extension
  2. Build to native using mvn clean package -Dnative
  3. See the output. You may see the following warning:
Warning: The option '-H:IncludeResourceBundles=yasson-messages' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future.
Warning: Please re-evaluate whether any experimental option is required, and either remove or unlock it. The build output lists all active experimental options, including where they come from and possible alternatives. If you think an experimental option should be considered as stable, please file an issue.

Output of uname -a or ver

Darwin MacBook-Pro-de-George 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:10:42 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6000 arm64

Output of java -version

openjdk version "21.0.2" 2024-01-16

Mandrel or GraalVM version (if different from Java)

OpenJDK Runtime Environment GraalVM CE 21.0.2+13.1 (build 21.0.2+13-jvmci-23.1-b30)

Quarkus version or git rev

3.10.0

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.9.6

Additional information

No response

@gastaldi gastaldi added kind/bug Something isn't working area/native-image labels May 10, 2024
@quarkus-bot
Copy link

quarkus-bot bot commented May 10, 2024

/cc @Karm (mandrel), @galderz (mandrel), @zakkak (mandrel,native-image)

@gastaldi
Copy link
Contributor Author

@zakkak
Copy link
Contributor

zakkak commented May 13, 2024

Hi @gastaldi, that's intended behavior:

to limit the scope as suggested in oracle/graal#7105 (comment). Alternatively we could just pass -H:+UnlockExperimentalVMOptions as the first option and allow any experimental option to be passed afterwards. It would make things simpler but would also allow people (both Quarkus users and devs) to use experimental options possibly without noticing.

As mentioned in #35379 (comment)

@zakkak zakkak closed this as not planned Won't fix, can't repro, duplicate, stale May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/native-image kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants