Skip to content

Commit 51918e1

Browse files
aepfliCopilot
andcommitted
fix(flagd): cap container pool size to avoid Docker overload
Default pool size was Runtime.availableProcessors() which on large machines (22 CPUs) spawned too many simultaneous Docker Compose stacks and caused ContainerLaunchException. Cap at min(availableProcessors, 4). Cucumber threads still scale with CPUs (dynamic factor=1) — extra threads simply block waiting for a free container, which is safe. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Simon Schrottner <simon.schrottner@dynatrace.com>
1 parent 75ee3b0 commit 51918e1

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

providers/flagd/src/test/java/dev/openfeature/contrib/providers/flagd/e2e/ContainerPool.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
@Slf4j
3030
public class ContainerPool {
3131

32-
private static final int POOL_SIZE =
33-
Integer.getInteger("flagd.e2e.pool.size", Runtime.getRuntime().availableProcessors());
32+
private static final int POOL_SIZE = Integer.getInteger(
33+
"flagd.e2e.pool.size", Math.min(Runtime.getRuntime().availableProcessors(), 4));
3434

3535
private static final BlockingQueue<ContainerEntry> pool = new LinkedBlockingQueue<>();
3636
private static final List<ContainerEntry> all = new ArrayList<>();

providers/flagd/src/test/resources/junit-platform.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
# concurrent scenarios are fully isolated — no shared flagd process.
44
cucumber.execution.parallel.enabled=true
55
# Dynamic strategy scales with available CPUs (factor=1.0 → 1 thread per core).
6-
# ContainerPool defaults to Runtime.availableProcessors() so pool slots match.
7-
# Override both via -Dflagd.e2e.pool.size=N and
8-
# -Dcucumber.execution.parallel.config.dynamic.factor=N if needed.
6+
# ContainerPool caps at min(availableProcessors, 4) containers so Docker isn't
7+
# overwhelmed; extra threads simply block waiting for a free container.
8+
# Override pool size via -Dflagd.e2e.pool.size=N if needed.
99
cucumber.execution.parallel.config.strategy=dynamic
1010
cucumber.execution.parallel.config.dynamic.factor=1
1111
# Scenarios tagged @env-var mutate System env vars globally.

0 commit comments

Comments
 (0)