0

I have deployed a micronaut lambda native image as AWS Lambda. But when I did a test I am getting following error

INIT_START Runtime Version: provided:al2.v16 Runtime Version ARN: arn:aws:lambda:eu-west-1::runtime:a877059c39f5d33441dc2aac00a8beba450c75fa8d69c4c71e7de2cca4659967
error: Could not find option 'MaxPermSize'. Use -XX:PrintFlags= to list all available options.
RequestId: 9db49a67-91a6-4442-a446-e6f905c20415 Error: Runtime exited with error: exit status 1
Runtime.ExitError

Basically tried example from https://guides.micronaut.io/latest/mn-application-aws-lambda-graalvm-gradle-java.html

I have build a native image on an Ubuntu machine while using graalvm jvm 22.3.r11-grl installed via sdk. And then uploaded the generated zip file as AWS Lambda code.

used following command to build native image

./gradlew buildNativeLambda

Only change I did was I added "-XX:MaxPermSize=2048m", to dockerfileNative task as I did not had enough memory to build the image.

tasks.named("dockerfileNative") {
    args(
        "-XX:MaxPermSize=2048m",
        "-XX:MaximumHeapSizePercent=80",
        "-Dio.netty.allocator.numDirectArenas=0",
        "-Dio.netty.noPreferDirect=true"
    )
}

Following is the snippet from the build output where it starts using the graalvm docker image.

Step 1/27 : FROM amazonlinux:latest AS graalvm
 ---> ee4570b57b03
Step 2/27 : ENV LANG=en_US.UTF-8
 ---> Using cache
 ---> ab5229640881
Step 3/27 : RUN yum install -y gcc gcc-c++ libc6-dev zlib1g-dev curl bash zlib zlib-    devel zlib-static zip tar gzip
 ---> Using cache
 ---> 0b8b8090b0d2
Step 4/27 : RUN curl -4 -L https://github.com/graalvm/graalvm-ce-    builds/releases/download/vm-22.3.0/graalvm-ce-java11-linux-amd64-22.3.0.tar.gz -o     /tmp/graalvm-ce-java11-linux-amd64-22.3.0.tar.gz
 ---> Using cache
 ---> a0056de925cc
Step 5/27 : RUN tar -zxf /tmp/graalvm-ce-java11-linux-amd64-22.3.0.tar.gz -C /tmp && mv /tmp/graalvm-ce-java11-22.3.0 /usr/lib/graalvm
 ---> Using cache
 ---> 7b50cdea62fd
Step 6/27 : RUN rm -rf /tmp/*
 ---> Using cache
 ---> 232bc6614199
Step 7/27 : RUN /usr/lib/graalvm/bin/gu install native-image
 ---> Using cache
 ---> 0ce1b965d4a2
Step 8/27 : CMD ["/usr/lib/graalvm/bin/native-image"]
 ---> Using cache
 ---> 8c6372d00800
Step 9/27 : ENV PATH=/usr/lib/graalvm/bin:${PATH}
 ---> Using cache
 ---> e062c02ff7e8
Step 10/27 : FROM graalvm AS builder
 ---> e062c02ff7e8
Step 11/27 : WORKDIR /home/app
 ---> Using cache
 ---> 8f3313de18d7
Step 12/27 : COPY layers/libs /home/app/libs

In the Lambda I also added env var as JAVA_TOOLS_OPTIONS -XX:MaxPermSize=2048m

But this continuous to throw the same error. Can somebody please help.

Arif Shaikh
  • 79
  • 3
  • 10
  • This option was deprecated and removed in JDK 9 or something. Run your native image with `-XX:PrintFlags=` flag to see complete list of runtime options. – peterz Mar 09 '23 at 09:58
  • tried following env var JAVA_TOOLS_OPTIONS -XX:+UnlockDiagnosticVMOptions -XX:+PrintFlagsFinal Same error result. – Arif Shaikh Mar 10 '23 at 00:31
  • as described https://stackoverflow.com/a/73545335/175554 you can not use MaxPermSize after java 17. – ozkanpakdil Apr 01 '23 at 08:39

0 Answers0