oracle / graal

GraalVM compiles Java applications into native executables that start instantly, scale fast, and use fewer compute resources 🚀
https://www.graalvm.org
Other
20.4k stars 1.64k forks source link

org.graalvm.compiler.debug.GraalError: failed guarantee: Addend has to be 24bit signed number. Got value 0x800000 #7956

Open manuelwallrapp opened 11 months ago

manuelwallrapp commented 11 months ago

If I build my Quarkus App with GraalVM 21.01. There exists a similar bug

java --version output: java 21.0.1 2023-10-17 Java(TM) SE Runtime Environment Oracle GraalVM 21.0.1+12.1 (build 21.0.1+12-jvmci-23.1-b19) Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 21.0.1+12.1 (build 21.0.1+12-jvmci-23.1-b19, mixed mode, sharing)

There existed a similar Issue: https://github.com/oracle/graal/issues/7367

========================================================================================================================
GraalVM Native Image: Generating 'esta-tekton-pipeline-controller-2.23.8-SNAPSHOT-runner' (executable)...
========================================================================================================================
[1/8] Initializing...                                                                                   (12.8s @ 1.00GB)
 Java version: 21.0.1+12, vendor version: Oracle GraalVM 21.0.1+12.1
 Graal compiler: optimization level: 2, target machine: armv8-a, PGO: off
 C compiler: cc (apple, arm64, 15.0.0)
 Garbage collector: Serial GC (max heap size: 80% of RAM)
 4 user-specific feature(s):
 - com.oracle.svm.thirdparty.gson.GsonFeature
 - io.quarkus.caffeine.runtime.graal.CacheConstructorsFeature
 - io.quarkus.runner.Feature: Auto-generated class by Quarkus from the existing extensions
 - io.quarkus.runtime.graal.DisableLoggingFeature: Disables INFO logging during the analysis phase
------------------------------------------------------------------------------------------------------------------------
 4 experimental option(s) unlocked:
 - '-H:+AllowFoldMethods' (origin(s): command line)
 - '-H:BuildOutputJSONFile' (origin(s): command line)
 - '-H:-UseServiceLoaderFeature' (origin(s): command line)
 - '-H:ReflectionConfigurationResources' (origin(s): 'META-INF/native-image/io.micrometer/micrometer-core/native-image.properties' in 'file:///Users/manuel/devsbb/workspaces/esta-tekton-pipeline-controller/target/esta-tekton-pipeline-controller-2.23.8-SNAPSHOT-native-image-source-jar/lib/io.micrometer.micrometer-core-1.11.5.jar', 'META-INF/native-image/io.netty/netty-transport/native-image.properties' in 'file:///Users/manuel/devsbb/workspaces/esta-tekton-pipeline-controller/target/esta-tekton-pipeline-controller-2.23.8-SNAPSHOT-native-image-source-jar/lib/io.netty.netty-transport-4.1.100.Final.jar')
------------------------------------------------------------------------------------------------------------------------
Build resources:
 - 21.31GB of memory (33.3% of 64.00GB system memory, determined at start)
 - 10 thread(s) (100.0% of 10 available processor(s), determined at start)
[2/8] Performing analysis...  [08:27:14,699 WARN  [io.qua.config] Unrecognized configuration key "quarkus.opentelemetry.tracer.exporter.otlp.endpoint" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo
08:27:14,702 WARN  [io.qua.config] Unrecognized configuration key "quarkus.opentelemetry.enabled" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo
08:30:09,351 WARN  [io.net.res.dns.DnsServerAddressStreamProviders] Can not find io.netty.resolver.dns.macos.MacOSDnsServerAddressStreamProvider in the classpath, fallback to system defaults. This may result in incorrect DNS resolutions on MacOS. Check whether you have a dependency on 'io.netty:netty-resolver-dns-native-macos'
*****]                                                                 (234.0s @ 12.47GB)
   52’717 reachable types   (93.3% of   56’517 total)
  102’598 reachable fields  (80.4% of  127’549 total)
  463’525 reachable methods (83.1% of  558’079 total)
   31’158 types, 59’777 fields, and 259’620 methods registered for reflection
       79 types,    81 fields, and    62 methods registered for JNI access
        5 native libraries: -framework CoreServices, -framework Foundation, dl, pthread, z
[3/8] Building universe...                                                                              (10.5s @ 9.40GB)
[4/8] Parsing methods...      [****]                                                                    (12.8s @ 7.57GB)
[5/8] Inlining methods...     [***]                                                                      (2.5s @ 6.21GB)
[6/8] Compiling methods...    [*************]                                                         (189.9s @ 12.72GB)
[7/8] Layouting methods...    [******]                                                                 (43.8s @ 14.94GB)
[8/8] Creating image...       [*****
]                                                                   (0.0s @ 12.63GB)
------------------------------------------------------------------------------------------------------------------------
                       46.0s (8.6% of total time) in 248 GCs | Peak RSS: 20.58GB | CPU load: 7.42
------------------------------------------------------------------------------------------------------------------------
Produced artifacts:
 /Users/manuel/devsbb/workspaces/esta-tekton-pipeline-controller/target/esta-tekton-pipeline-controller-2.23.8-SNAPSHOT-native-image-source-jar/svm_err_b_20231205T083555.756_pid6853.md (build_info)
========================================================================================================================
Failed generating 'esta-tekton-pipeline-controller-2.23.8-SNAPSHOT-runner' after 8m 55s.

The build process encountered an unexpected error:

org.graalvm.compiler.debug.GraalError: failed guarantee: Addend has to be 24bit signed number. Got value 0x800000
        at jdk.internal.vm.compiler/org.graalvm.compiler.debug.GraalError.guarantee(GraalError.java:100)
        at org.graalvm.nativeimage.objectfile/com.oracle.objectfile.macho.MachORelocationInfo.write(MachORelocationElement.java:300)
        at org.graalvm.nativeimage.objectfile/com.oracle.objectfile.macho.MachORelocationElement.getOrDecideContent(MachORelocationElement.java:93)
        at org.graalvm.nativeimage.objectfile/com.oracle.objectfile.ObjectFile.bake(ObjectFile.java:1625)
        at org.graalvm.nativeimage.objectfile/com.oracle.objectfile.macho.MachOObjectFile.bake(MachOObjectFile.java:1822)
        at org.graalvm.nativeimage.objectfile/com.oracle.objectfile.ObjectFile.write(ObjectFile.java:1282)
        at org.graalvm.nativeimage.objectfile/com.oracle.objectfile.ObjectFile.lambda$write$5(ObjectFile.java:1274)
        at org.graalvm.nativeimage.objectfile/com.oracle.objectfile.ObjectFile.withDebugContext(ObjectFile.java:1814)
        at org.graalvm.nativeimage.objectfile/com.oracle.objectfile.ObjectFile.write(ObjectFile.java:1273)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImage.write(NativeImage.java:166)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageViaCC.write(NativeImageViaCC.java:98)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:741)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:550)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:538)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:720)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.start(NativeImageGeneratorRunner.java:142)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:97)
selhagani commented 11 months ago

Hi @manuelwallrapp, could you please share with me your OS version and your processor's architecture? Also, could you include a concise reproducer for this issue?

manuelwallrapp commented 11 months ago

Hi @selhagani

I have following data: Processor Architecture is: Apple M1 Max OS: 14.1.2 (23B92) Memory: 64 Gb

I also tried to build with and get the same issue: java 17.0.9 2023-10-17 LTS Java(TM) SE Runtime Environment Oracle GraalVM 17.0.9+11.1 (build 17.0.9+11-LTS-jvmci-23.0-b21) Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 17.0.9+11.1 (build 17.0.9+11-LTS-jvmci-23.0-b21, mixed mode, sharing)

We have this issue since we updated the Quarkus Version from 3.5.3 to 3.6.0. Most probably a simple Quarkus Project will build, but our project has some lines of code which might be an Issue I can imagine.

manuelwallrapp commented 11 months ago

Is there an option I give you the sourcecode privately?

selhagani commented 11 months ago

You don't have to share with me the whole source code of your project. All we need is a simple and concise reproducer that will allow us to reproduce the error on our end.

manuelwallrapp commented 11 months ago

I could reproduce it with this little project.

Apache Maven 3.9.2 (c9616018c7a021c1c39be70fb2843d6f5f9b8a1c) Maven home: /Users/manuel/.sdkman/candidates/maven/current Java version: 21, vendor: Oracle Corporation, runtime: /Users/manuel/.sdkman/candidates/java/21-graal Default locale: en_CH, platform encoding: UTF-8 OS name: "mac os x", version: "14.1.2", arch: "aarch64", family: "mac"

I build it with this command: mvn clean install -Pnative -Dnet.bytebuddy.experimental -DskipTests

quarkus-graal-test.zip

I hope you can reproduce this error on your machine. On my machine the same error comes with the sample project.

selhagani commented 11 months ago

I'm afraid I can't test your project if you send it to me in a zip format since it's against our policy. Could you please provide a link to the repository of the sample project on Github? Thanks.

manuelwallrapp commented 11 months ago

Does this work for you?

https://github.com/manuelwallrapp/quarkus-graal-test.git

selhagani commented 11 months ago

I tried to reproduce the issue on my end using the project you provided, but I'm getting a different error. [ERROR] Failed to execute goal on project quarkus-graal-test: Could not resolve dependencies for project org.acme:quarkus-graal-test:jar:1.0.0-SNAPSHOT: Could not find artifact ch.sbb.esta.quarkus.tektonclient:esta-quarkus-tekton-client:jar:3.6.0 in central (https://repo.maven.apache.org/maven2)

manuelwallrapp commented 11 months ago

Ok, I removed the internal dependency. Need to pull and try again.

selhagani commented 11 months ago

I managed to reproduce the issue on my end. I shared this with our dev team. Thanks for sharing this bug with us.

metacosm commented 10 months ago

Any update on this? When can we expect a release with a fix for this issue?

selhagani commented 10 months ago

No updates just yet. I will share an update with you as soon as I have one. Thanks for your patience.

metacosm commented 10 months ago

No updates just yet. I will share an update with you as soon as I have one. Thanks for your patience.

Thank you! Hopefully it won't be much longer…

manuelwallrapp commented 10 months ago

With the new GraalVM 21.0.2 Community Edition I bring the build through. With the GraalVM 21.0.2 Oracle not. Kinda weird. Maybe you can test as well @metacosm ?

manuelwallrapp commented 10 months ago

So I tested the build two times with each GraalVM which I select with sdkman.io. There I have two identifiers: 21.0.2-graalce (Community Edition) works with this one. 21.0.2-graal (Oracle)

The Community Edition builds faster, with less memory and without failure. With the Oracle version I have still the error above and it runs into a outofmemory error while the Community Edition doesn't when I tighten the memory settings.

metacosm commented 10 months ago

21.0.2-graalce seems to work for my use case. Oracle fails with the same error. Weird.

lewurm commented 9 months ago

We landed a fix that addresses this partially a while ago (master: https://github.com/oracle/graal/commit/925e13883488d3e9e2bd8c7409e9bf2d3e18f5c3 and 22.3: https://github.com/oracle/graal/commit/35328305fa4d7c309ea4a39d13709d5d0ea0ce15). So could you try a newer GraalVM release, at least 22.3? The reproducer at https://github.com/manuelwallrapp/quarkus-graal-test.git works locally for me with a recent snapshot release.

That said, there is still room for improvement to handle this situation better. We have a ticket internally for that (GR-46421).