apache / apache/shenyu

[BUG] — Disruptor consumer→executor handoff to an unbounded `LinkedBlockingQueue` breaks backpressure

Open
#6,669 1 comment 0 reactions 0 assignees View on GitHub
priority: high type: performance
Dominant language
Java
Stars
8.8k
Forks
3.1k
Avg merge
7d 1h
Merged PRs (30d)
85

Description

- severity: High
- files: `shenyu-disruptor/src/main/java/org/apache/shenyu/disruptor/DisruptorProviderManage.java:108-110` (`OrderlyExecutor(consumerSize, consumerSize, 0, MS, new LinkedBlockingQueue<>(), ..., AbortPolicy)`), `shenyu-disruptor/src/main/java/org/apache/shenyu/disruptor/thread/SingletonExecutor.java:32-34` (1,1,0,`new LinkedBlockingQueue<>()`), `QueueConsumer.java:58` (`executor.execute(queueConsumerExecutor)`)
- description: The Disruptor ring buffer (`DEFAULT_SIZE=16384`) is bounded, but `QueueConsumer.onEvent` hands each consumed event to an executor backed by an *unbounded* queue. When consumers are slower than producers (e.g. admin persisting registrations to DB), the executor queue grows without bound → OOM. `AbortPolicy` is dead code (an unbounded queue never rejects). For orderly events the single `SingletonExecutor` thread is the per-key bottleneck.
- impact: `RegisterClientServerDisruptorPublisher` (admin) and `ShenyuClientRegisterEventPublisher` (client) accumulate unbounded queued tasks under registration burst / DB slowdown.
- suggested_fix: Bound the executor queue (`ArrayBlockingQueue` sized to ring-buffer slots) with `CallerRunsPolicy` (or block-the-producer) so Disruptor backpressure propagates to the consumer.
- 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

Start with QueueConsumer.onEvent and trace the executor construction at DisruptorProviderManage.java:108-110 and thread/SingletonExecutor.java:32-34. Compare the handoff used by RegisterClientServerDisruptorPublisher and ShenyuClientRegisterEventPublisher; done means their executor queues are bounded or block the producer so registration bursts cannot grow queued tasks without limit.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.