[BUG] — Shared gateway thread pool defaults to `maximumPoolSize = Integer.MAX_VALUE` (unbounded eager thread spawning before queue is consulted)
- Dominant language
- Java
- Stars
- 8.8k
- Forks
- 3.1k
- Avg merge
- 7d 1h
- Merged PRs (30d)
- 85
Description
- severity: High
- files: `shenyu-common/src/main/java/org/apache/shenyu/common/config/ShenyuConfig.java:1669` (`private Integer maximumPoolSize = Integer.MAX_VALUE;`); wiring `shenyu-web/src/main/java/org/apache/shenyu/web/configuration/ShenyuThreadPoolConfiguration.java:104-107` (core=200, max=Integer.MAX_VALUE, `MemorySafeTaskQueue(256MB)`, `AbortPolicy`); `TaskQueue.java:57-58` (`offer` returns `false` while `currentPoolThreadSize < maximumPoolSize`)
- description: The "eager" `TaskQueue` returns `false` whenever `currentPoolThreadSize < maximumPoolSize`, forcing `ThreadPoolExecutor` to spawn a new worker instead of queueing. With `max=Integer.MAX_VALUE` a sustained burst spawns threads without bound (each ~1 MB stack) *before* the memory-bounded queue is ever consulted. `AbortPolicy` is effectively unreachable. This pool backs all plugin/async work on the gateway.
- impact: Thread explosion / OOM under burst on the core gateway pool; `corePoolSize=200` is already a high idle footprint.
- suggested_fix: Default `maximumPoolSize` to a bounded, configurable value (e.g. `4 * availableProcessors` or a documented cap).
- confidence: High
---
_Identified during the 2026-08-02 deep re-scan; full list in [`docs/scan2-2026-08-02/00-consolidated-critical-high.md`](docs/scan2-2026-08-02/00-consolidated-critical-high.md)._
Contributor guide
No contributing guide indexed for this repository
Research direction
Read ShenyuConfig.java:1669 and ShenyuThreadPoolConfiguration.java:104-107 first, then trace TaskQueue.java:57-58 to confirm how the shared gateway pool handles bursts. Done means the default maximum pool size is bounded and configurable, and the memory-safe queue and AbortPolicy can be reached instead of permitting unbounded worker creation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, performance
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100