apache / apache/shenyu

[BUG] Exponential/Fixed retry strategies: outer timeout neuters configured retry count

Open
#6,583 1 comment 0 reactions 0 assignees View on GitHub
plugin: http-client priority: medium type: performance
Dominant language
Java
Stars
8.8k
Forks
3.1k
Avg merge
7d 9h
Merged PRs (30d)
83

Description

## Description
The `response` Mono passed in is already wrapped with `.timeout(duration)` in `AbstractHttpClientPlugin` (per-attempt timeout). Then the retry strategy wraps the ENTIRE retry chain in another `.timeout(duration)`. With `duration=3s` and `Retry.fixedDelay(3, Duration.ofSeconds(2))`, the outer 3s timeout fires before the 2s delay completes, so an operator configuring `retryTimes=3` actually gets at most 1 retry. (Counterpart: `DefaultRetryStrategy` "current" mode has NO outer timeout on the retry chain, so with `retryTimes=5` and `maxBackoff=20s` a dead-upstream request can occupy a connection for up to ~115s — slow-death amplification.)

## Location
```
shenyu-plugin-httpclient/.../ExponentialRetryBackoffStrategy.java:53-54
FixedRetryStrategy.java:52-53
```

## Impact
Configured retry counts are silently ineffective (Exponential/Fixed), or unbounded connection occupation (Default "current").

## Suggested fix
Use a separate, longer timeout for the retry chain (e.g. `duration * (retryTimes + 1)` + backoff), or remove the inner per-attempt timeout and let the chain's outer timeout be the sole bound. Add an outer deadline to the DefaultRetryStrategy "current" mode.

## Related existing issue(s)
None

_Identified during the 2026-08-02 audit; full list in [`docs/issue-candidates-2026-08-02.md`](docs/issue-candidates-2026-08-02.md)._

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with ExponentialRetryBackoffStrategy.java:53-54 and FixedRetryStrategy.java:52-53, then trace how AbstractHttpClientPlugin applies the per-attempt timeout and inspect DefaultRetryStrategy's current mode. Compare the retry-chain deadline with configured retry counts and backoff. Done means configured retries are not cut short and the current mode has a bounded connection occupation time.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
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.