Run a different garbage collector with Java 11 runtime

0

I would like to run a different jvm garbage collector during my Lambda execution, for example:

https://openjdk.org/jeps/318 - Epsilon GC introduced as experimental feature in Java 11

But this is what I get:

---------------------------------------------------------------------------------------------------------------------------------------------------------------
|   timestamp   |                                                                   message                                                                   |
|---------------|---------------------------------------------------------------------------------------------------------------------------------------------|
| 1620661265366 | Picked up JAVA_TOOL_OPTIONS: -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC -Xlog:gc                                                    |
| 1620661265368 | Error occurred during initialization of VM                                                                                                  |
| 1620661265368 | Multiple garbage collectors selected                                                                                                        |
| 1620661265423 | START RequestId: 7a53b824-821d-4255-8d5a-e3bad38300f1 Version: $LATEST                                                                      |
| 1620661265428 | Picked up JAVA_TOOL_OPTIONS: -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC -Xlog:gc                                                    |
| 1620661265429 | Error occurred during initialization of VM                                                                                                  |
| 1620661265429 | Multiple garbage collectors selected                                                                                                        |
| 1620661265430 | END RequestId: 7a53b824-821d-4255-8d5a-e3bad38300f1                                                                                         |
| 1620661265430 | REPORT RequestId: 7a53b824-821d-4255-8d5a-e3bad38300f1 Duration: 6.01 ms Billed Duration: 7 ms Memory Size: 1024 MB Max Memory Used: 8 MB   |
| 1620661265430 | RequestId: 7a53b824-821d-4255-8d5a-e3bad38300f1 Error: Runtime exited with error: exit status 1 Runtime.ExitError                           |
---------------------------------------------------------------------------------------------------------------------------------------------------------------

Any clue ?

Thank you in advance

Gianluca

asked 9 months ago655 views
3 Answers
1

It seems impossibile to run a different garbage collector with Corretto 11 runtime.

Per docs, It is only mentioned to work with Corretto 17 runtime.

Anyway, the instruction are the following:

docker run -p 9000:8080 --env JAVA_TOOL_OPTIONS='-XX:+UnlockExperimentalVMOptions -XX:+PrintCommandLineFlags -XX:+UseEpsilonGC -Xlog:gc' echo-lambda:0.1.0

Gianluca

answered 9 months ago
0

Hi, "Multiple garbage collectors selected " would say that you run another GC by default (G1GC ?). So, i'd try to deactivate this other GC by adding -XX:-UseG1GC (or equivalent if default GC is another one) to your -XX:+UseEpsilonGC in JAVA_TOOL_OPTIONS.

Best,

Didier

profile pictureAWS
EXPERT
answered 9 months ago
0

It still gives me error:

docker run -p 9000:8080 --env JAVA_TOOL_OPTIONS='-XX:-UseG1GC -XX:+UnlockExperimentalVMOptions -XX:+PrintCommandLineFlags -XX:+UseEpsilonGC -Xlog:gc' echo-lambda:0.1.0

20 Jul 2023 08:33:38,305 [INFO] (rapid) exec '/var/runtime/bootstrap' (cwd=/var/task, handler=)
START RequestId: 4558a7d8-8f8d-43ce-a3e2-a95a01d029d4 Version: $LATEST
20 Jul 2023 08:33:41,981 [INFO] (rapid) extensionsDisabledByLayer(/opt/disable-extensions-jwigqn8j) -> stat /opt/disable-extensions-jwigqn8j: no such file or directory
20 Jul 2023 08:33:41,981 [INFO] (rapid) Configuring and starting Operator Domain
20 Jul 2023 08:33:41,981 [INFO] (rapid) Starting runtime domain
20 Jul 2023 08:33:41,981 [WARNING] (rapid) Cannot list external agents error=open /opt/extensions: no such file or directory
20 Jul 2023 08:33:41,981 [INFO] (rapid) Starting runtime without AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN , Expected?: false
Picked up JAVA_TOOL_OPTIONS: -XX:-UseG1GC -XX:+UnlockExperimentalVMOptions -XX:+PrintCommandLineFlags -XX:+UseEpsilonGC -Xlog:gc
Error occurred during initialization of VM
Multiple garbage collectors selected
20 Jul 2023 08:33:41,988 [WARNING] (rapid) First fatal error stored in appctx: Runtime.ExitError
20 Jul 2023 08:33:41,988 [WARNING] (rapid) Process runtime-1 exited: exit status 1
20 Jul 2023 08:33:41,988 [ERROR] (rapid) Init failed error=Runtime exited with error: exit status 1 InvokeID=
20 Jul 2023 08:33:41,989 [INFO] (rapid) Starting runtime domain
20 Jul 2023 08:33:41,989 [WARNING] (rapid) Cannot list external agents error=open /opt/extensions: no such file or directory
END RequestId: 5e68d810-56a0-4d67-84f3-3aa39c36b025
REPORT RequestId: 5e68d810-56a0-4d67-84f3-3aa39c36b025	Init Duration: 0.31 ms	Duration: 7.76 ms	Billed Duration: 8 ms	Memory Size: 3008 MB	Max Memory Used: 3008 MB
answered 9 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions