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

已提問 1 年前檢視次數 815 次
3 個答案
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

已回答 1 年前
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
專家
已回答 1 年前
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
已回答 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南