Skip to content

fix: bound fixed thread pool queue - #1308

Open
2769194950 wants to merge 1 commit into
apache:masterfrom
2769194950:fix/bound-fixed-thread-pool
Open

2769194950 wants to merge 1 commit into
apache:masterfrom
2769194950:fix/bound-fixed-thread-pool

Conversation

@2769194950

@2769194950 2769194950 commented Sep 21, 2026

Copy link
Copy Markdown

Description

Fixes #1283.

ThreadUtils.newFixedThreadPool delegated to Executors.newFixedThreadPool, which uses an effectively unbounded LinkedBlockingQueue. Under sustained ZooKeeper latency or callback bursts, submitted tasks could accumulate without a memory bound.

This changes the executor to a fixed-size ThreadPoolExecutor with:

  • a bounded queue of 10,000 tasks;
  • CallerRunsPolicy to apply backpressure without silently dropping work;
  • the existing thread count and Curator thread factory.

Added a regression test that verifies the queue bound and rejection policy.

Testing

mvnw.cmd -ntp -pl curator-client -am -Dtest=TestThreadUtils -Dsurefire.failIfNoSpecifiedTests=false test

Result: TestThreadUtils 1/1 passed; the 3-module reactor completed successfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Potential OOM in ThreadUtils due to unbounded newFixedThreadPool

1 participant