quarkusio / quarkus-images

Set of container images delivered for Quarkus
Apache License 2.0
115 stars 76 forks source link

can't specify memory limit on s2i native image #159

Closed r-lam closed 3 years ago

r-lam commented 3 years ago

Hi, I'm trying to use the ubi-quarkus-native-s2i image with memory limit to 4G defining the property:

quarkus.native.additional-build-args=-J-Xmx4G

And this is the command that the image build:

/opt/graalvm/bin/native-image -J-DCoordinatorEnvironmentBean.transactionStatusManagerEnable=false -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -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=US -J-Dfile.encoding=UTF-8 -J-Xmx4G --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy\$BySpaceAndTime -H:+JNI -H:+AllowFoldMethods

However when running on Openshift, the consumptions goes up to +5G even when -J-Xmx is set to 3G so I'm assuming that property is being ignored and obviously my build failed because the pod was killed.

Error:

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

(Edited) I've done some test locally (without containers/the image) and it works, the property does limit the graal service.

My use case is not critical on build times, therefore, we choose to apply limits to memory consumption.

cescoffier commented 3 years ago

Did you try to set quarkus.native.native-image-xmx in your application.properties?

r-lam commented 3 years ago

Same result.

cescoffier commented 3 years ago

The 137 indicates that you ran out of memory. You need to increase the memory not reducing it.

r-lam commented 3 years ago

So basically no way to limit memory at the cost of time mmm... Ok, thanks!

Will see if we can increase memory.