Building a native image with graalvm ce rc11 & rc12, I occasionally see the following error;
Error: Image building with exit status 137
This occurs if the system runs out of ram (including free swap pages) and the OOM Killer terminates the native image build process.
The error message seen by users is not very informative. Could we capture the exit code of the native-image process, and if equal to 137, display a more helpful message to users?
[INFO] [io.quarkus.creator.phase.nativeimage.NativeImagePhase] /opt/graalvm-ce-1.0.0-rc11//bin/native-image -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dcom.sun.xml.bind.v2.bytecode.ClassTailor.noOptimize=true -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime -jar broker-service-0.10.0-runner.jar -J-Djava.util.concurrent.ForkJoinPool.common.parallelism=1 -H:+PrintAnalysisCallTree -H:EnableURLProtocols=http -H:NativeLinkerOption=-no-pie -H:-SpawnIsolates -H:-JNI --no-server -H:-UseServiceLoaderFeature -H:+StackTrace
[broker-service-0.10.0-runner:15792] classlist: 7,589.30 ms
17:04:19,971 INFO [com.sun.xml.bin.v2.run.ref.opt.AccessorInjector] The optimized code generation is disabled
[broker-service-0.10.0-runner:15792] (cap): 1,006.80 ms
[broker-service-0.10.0-runner:15792] setup: 28,626.98 ms
17:04:57,314 INFO [org.hib.Version] HHH000412: Hibernate Core {5.4.1.Final}
17:04:57,410 INFO [org.hib.ann.com.Version] HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
17:04:57,565 INFO [org.hib.dia.Dialect] HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL9Dialect
17:04:57,771 INFO [org.jbo.res.res.i18n] RESTEASY002225: Deploying javax.ws.rs.core.Application: class io.quarkus.benchmark.insurance.agents.AgentsApplication
17:05:14,042 INFO [com.arj.ats.arjuna] ARJUNA012170: TransactionStatusManager started on port 35787 and host 127.0.0.1 with service com.arjuna.ats.arjuna.recovery.ActionStatusService
17:05:15,285 INFO [org.xnio] XNIO version 3.6.5.Final
17:05:15,704 INFO [org.xni.nio] XNIO NIO Implementation Version 3.6.5.Final
17:05:18,459 INFO [org.jbo.threads] JBoss Threads version 3.0.0.Alpha4
[broker-service-0.10.0-runner:15792] (typeflow): 70,162.22 ms
[broker-service-0.10.0-runner:15792] (objects): 29,723.67 ms
[broker-service-0.10.0-runner:15792] (features): 808.31 ms
[broker-service-0.10.0-runner:15792] analysis: 141,753.91 ms
Printing call tree to /home/johara/Work/projects/istio-benchmark/broker-service/target/reports/call_tree_broker-service-0.10.0-runner_20190301_170757.txt
Printing list of used classes to /home/johara/Work/projects/istio-benchmark/broker-service/target/reports/used_classes_broker-service-0.10.0-runner_20190301_170805.txt
Printing list of used packages to /home/johara/Work/projects/istio-benchmark/broker-service/target/reports/used_packages_broker-service-0.10.0-runner_20190301_170805.txt
[broker-service-0.10.0-runner:15792] universe: 2,513.22 ms
[broker-service-0.10.0-runner:15792] (parse): 9,026.74 ms
[broker-service-0.10.0-runner:15792] (inline): 8,000.62 ms
[broker-service-0.10.0-runner:15792] (compile): 79,834.58 ms
[broker-service-0.10.0-runner:15792] compile: 136,350.99 ms
[broker-service-0.10.0-runner:15792] image: 6,252.18 ms
Error: Image building with exit status 137
This appears to be related to memory available to build native image. The native-image tool used to report an OutOfMemory exception, but in recent graal release it appears that a build can fail with exit status 137 if there is insufficient memory to complete a native image build
re-opening to track enhancement for capturing exit code of native-image builder process
+1 for improvement. Capturing these error codes and providing an actual verbose and useful error message would remove a lot of frustration, saving businesses and employees time and money.
You really need to improve memory usage on this build process, I had to set 10GB !!! in Windows Docker desktop to successfully built very basic app, as it failed with 8GB.
Same issue here but with both Micronaut and Quarkus. Maybe we need to create an issue towards GraalVM itself?
Do J-Xmx10G and -J-Xms5G help in the build process?
Most helpful comment
You really need to improve memory usage on this build process, I had to set 10GB !!! in Windows Docker desktop to successfully built very basic app, as it failed with 8GB.