[BUG] DisruptorProviderManage.startup is not idempotent — leaks disruptor + executor on re-entry
Author: Aias00Created Aug 3, 2026Updated Sep 18, 2026
Labelstype: bugpriority: medium
- Severity: Medium
- Location:
shenyu-disruptor/src/main/java/org/apache/shenyu/disruptor/DisruptorProviderManage.java:98-134
Description:
startup() unconditionally constructs a new OrderlyExecutor, a new Disruptor, new QueueConsumers, and overwrites this.provider without shutting down any prior instance. No guard (provider != null) and no shutdown of previously-assigned disruptor/executor. Threads are daemon=false.
Impact:
Any code path calling startup() a second time (reconnect, re-init, retry, test re-entry) leaks the previous Disruptor's non-daemon provider threads plus OrderlyExecutor/SingletonExecutor threads; prevents JVM exit and grows thread counts.
Suggested fix:
Guard with AtomicBoolean started; on re-entry if (provider != null) shutdown() first; make startup idempotent.
Confidence: Medium
- Related existing: none — #6262 is
shutdown()not closing executor; this isstartup()not closing the previous instance on re-entry.
Identified during the 2026-08-02 deep re-scan; full list in docs/scan2-2026-08-02/06-medium-tiers.md.
Source: apache/shenyu