apache / apache/shenyu

[BUG] ExponentialRetryBackoffStrategy retries only on IllegalStateException, never on real network errors

Open Beginner friendly
#6,636 1 comment 0 reactions 0 assignees View on GitHub
plugin: http-client priority: high type: bug
Dominant language
Java
Stars
8.8k
Forks
3.1k
Avg merge
7d 1h
Merged PRs (30d)
85

Description

- severity: High
- files: `shenyu-plugin/shenyu-plugin-httpclient/src/main/java/org/apache/shenyu/plugin/httpclient/ExponentialRetryBackoffStrategy.java:65`
- description: `initDefaultBackoff` builds `Retry.backoff(...).filter(t -> t instanceof IllegalStateException)`. The actual outbound failures — `ConnectTimeoutException`, `ReadTimeoutException`, `IOException`, `WebClientResponseException`, "Connection prematurely closed" — are not `IllegalStateException`, so `retryWhen` never retries them. Compare `FixedRetryStrategy` which has no filter (retries all).
- impact: Operators configuring `retryBackoffSpec=exponential` get zero retries on transient connection/timeout failures — silent no-op.
- suggested_fix: Broaden the filter to admit `IOException`/`TimeoutException`/`ConnectTimeoutException`/`ReadTimeoutException`, or drop the filter.
- confidence: High
- related_existing: none — #6583/PERF-32 is the outer `.timeout()` wrapping; this is the inner `.filter()` that suppresses all retries regardless.

---
_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 at shenyu-plugin/shenyu-plugin-httpclient/src/main/java/org/apache/shenyu/plugin/httpclient/ExponentialRetryBackoffStrategy.java:65 and compare the retry behavior with FixedRetryStrategy. Trace the filter used by initDefaultBackoff and verify that the listed transient outbound failures are retried rather than suppressed; done when exponential backoff no longer silently performs zero retries for them.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.