I am trying to setup a Bitbucket Pipeline for building a native Quarkus image of my app, but the build fails with
Caused by: java.lang.RuntimeException: Image generation failed. Exit code was 137 which indicates an out of memory error. Consider increasing the Xmx value for native image generation by setting the "quarkus.native.native-image-xmx" property
I have increased the size of the pipeline touse double amount of memory (8 GB instead of 4 GB) and tried to give docker more memory, but without any success. I have changed the database layer from mongodb to postgres. After that change the build fails with mentioned error. My bitbucket-pipelines.yml
:
pipelines:
branches:
develop:
- step:
name: Build Native Image
image: quay.io/quarkus/ubi-quarkus-native-image:21.2-java11
services:
- docker
size: 2x
caches:
- maven
script:
- ./mvnw package -Pnative
artifacts:
- target/*-runner
definitions:
service:
docker:
memory: 7128
Can I set other parameters to assign more memory to the build?
Graalvm will grab as much memory as it can get access to and sometimes that his the outer limit. Thus even if you give it more it will keep failing.
Thus it might be a question of actually constraining the JVM so graalvm will start garbage collecting sooner.
You do that setting -Dquarkus.native.native-image-xmx=5GB
as suggested by the error message and @geoand.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.