From 94e652e85c1f714e8f434a2d0669439398c884d0 Mon Sep 17 00:00:00 2001 From: Ken Stevens Date: Mon, 20 Oct 2025 10:47:03 -0400 Subject: [PATCH] [7312] Fix Elasticsearch container OOM failures in CI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added container memory limit of 700MB to prevent out-of-memory issues in CI environments. The JVM heap was already limited to 512MB via ES_JAVA_OPTS, but the container itself had no memory constraint, causing Elasticsearch to request more memory than available and be killed by the OOM killer. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../jpa/test/config/TestElasticsearchContainerHelper.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/config/TestElasticsearchContainerHelper.java b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/config/TestElasticsearchContainerHelper.java index 902a47e33083..1f9076800a1c 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/config/TestElasticsearchContainerHelper.java +++ b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/config/TestElasticsearchContainerHelper.java @@ -24,6 +24,7 @@ import java.time.Duration; import static java.time.temporal.ChronoUnit.SECONDS; +import static java.util.Objects.requireNonNull; public class TestElasticsearchContainerHelper { @@ -40,7 +41,9 @@ public static ElasticsearchContainer getEmbeddedElasticSearch() { .withEnv("xpack.security.enabled", "false") // turn off machine learning (we don't need it in tests anyways) .withEnv("xpack.ml.enabled", "false") - .withStartupTimeout(Duration.of(300, SECONDS)); + .withStartupTimeout(Duration.of(300, SECONDS)) + // Limit container memory to prevent OOM in CI environments + .withCreateContainerCmdModifier(c -> requireNonNull(c.getHostConfig()).withMemory(700_000_000L)); } }