apache / apache/shenyu

[BUG] GrpcPlugin blocks reactor netty event loop on synchronous gRPC call

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

Description

- severity: Critical
- files: `shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-grpc/src/main/java/org/apache/shenyu/plugin/grpc/GrpcPlugin.java:107`; `.../grpc/client/ShenyuGrpcClient.java:95`
- description: `doExecute` calls `client.call(...)` which internally does `this.invoke(callParams).get()` — a blocking `ListenableFuture.get()`. `Mono.fromFuture(result.thenApply(...))` at line 110 wraps an already-completed future (line 108 returns `CompletableFuture.completedFuture(...)`), providing no async scheduling. The entire gRPC RPC blocks the reactor netty event-loop thread for up to `extInfo.timeout` (default 5000ms).
- impact: Starves all other requests sharing that event-loop thread; under load causes cascading timeouts and thread starvation.
- suggested_fix: `Mono.fromCallable(() -> client.call(...)).subscribeOn(Schedulers.boundedElastic())` or make `ShenyuGrpcClient.call` return the uncompleted future without `.get()`.
- confidence: High
- related_existing: none — PERF-45 (ClickHouse `.get()`) is a different module; this is the gRPC plugin's own blocking call on the event loop.

---

## 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 GrpcPlugin.java:107-110 and ShenyuGrpcClient.java:95, tracing doExecute through client.call(...) and the blocking invoke(...).get() call. Compare the suggested scheduling or future-handling approaches, then verify that the gRPC RPC no longer blocks the Reactor Netty event-loop thread for the timeout period.

Written by the indexing model from the issue text.

Assessment

Tech stack
grpc, java
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.