Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keycloak container consumes too much memory in devmode #41813

Open
fedinskiy opened this issue Jul 10, 2024 · 1 comment · May be fixed by #41833
Open

Keycloak container consumes too much memory in devmode #41813

fedinskiy opened this issue Jul 10, 2024 · 1 comment · May be fixed by #41833
Labels

Comments

@fedinskiy
Copy link
Contributor

Describe the bug

After #41162 I get tests in Quarkas quickstarts fail with OOM exception inside DevMode containers. This issue can only be reproduced, when modules are run together and not one after another, when using machine with 8GB or less of memory

Expected behavior

Tests should not fail (as in 3.12.0)

Actual behavior

2024-06-24 20:57:40,506 INFO  [tc.qua.io/.0.0] (build-6) Container quay.io/keycloak/keycloak:25.0.0 is starting: b26499c6586fa4cc024748c6833d2e9074324cef0b3a4b648a7fce09a3f82382
2024-06-24 20:58:40,832 ERROR [tc.qua.io/.0.0] (build-6) Could not start container: java.lang.IllegalStateException: Wait strategy failed. Container exited with code 1
	at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:533)
	at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:354)
	at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81)
	at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:344)
	at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:330)
	at io.quarkus.oidc.deployment.devservices.keycloak.KeycloakDevServicesProcessor.lambda$startContainer$4(KeycloakDevServicesProcessor.java:377)
	at java.base/java.util.Optional.orElseGet(Optional.java:364)
	at io.quarkus.oidc.deployment.devservices.keycloak.KeycloakDevServicesProcessor.startContainer(KeycloakDevServicesProcessor.java:402)
	at io.quarkus.oidc.deployment.devservices.keycloak.KeycloakDevServicesProcessor.startKeycloakContainer(KeycloakDevServicesProcessor.java:198)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:849)
	at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
	at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521)
	at java.base/java.lang.Thread.run(Thread.java:840)
	at org.jboss.threads.JBossThread.run(JBossThread.java:483)
Caused by: org.testcontainers.containers.ContainerLaunchException: Timed out waiting for log output matching '.*Keycloak.*started.*'
	at org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy.waitUntilReady(LogMessageWaitStrategy.java:47)
	at org.testcontainers.containers.wait.strategy.AbstractWaitStrategy.waitUntilReady(AbstractWaitStrategy.java:52)
	at org.testcontainers.containers.GenericContainer.waitUntilContainerStarted(GenericContainer.java:909)
	at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:500)
	... 20 more

2024-06-24 20:58:40,849 ERROR [tc.qua.io/.0.0] (build-6) Log output from the failed container:
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000006af400000, 4034920448, 0) failed; error='Not enough space' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 4034920448 bytes. Error detail: committing reserved memory.
# An error report file with more information is saved as:
# /tmp/hs_err_pid87.log

How to Reproduce?

  1. git clone -b development https://github.com/quarkusio/quarkus-quickstarts.git && cd quarkus-quickstarts
  2. mvn clean verify

If run with mvn clean verify -Dquarkus.keycloak.devservices.java-opts="-XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90" or even mvn clean verify -Dquarkus.keycloak.devservices.java-opts="-XX:MaxMetaspaceSize=256m -XX:AdaptiveSizePolicyWeight=90", this doesn't fail

Output of uname -a or ver

4.18.0-553.5.1.el8_10.x86_64

Output of java -version

17.0.7, vendor: Red Hat, Inc.

Quarkus version or git rev

999-SNAPSHOT (see above)

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)

Additional information

Was fist created as a question[1], but later it was decided, that this worth filling a bug

[1] #41426 (reply in thread)

@fedinskiy fedinskiy added the kind/bug Something isn't working label Jul 10, 2024
@quarkus-bot
Copy link

quarkus-bot bot commented Jul 10, 2024

/cc @pedroigor (keycloak), @sberyozkin (keycloak)

@fedinskiy fedinskiy linked a pull request Jul 11, 2024 that will close this issue
fedinskiy added a commit to fedinskiy/quarkus that referenced this issue Jul 11, 2024
fedinskiy added a commit to fedinskiy/quarkus that referenced this issue Jul 12, 2024
fedinskiy added a commit to fedinskiy/quarkus that referenced this issue Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant