apache / apache/shenyu

[BUG] Retry sends empty request body when the original body stream is single-use

Open
#6,413 2 comments 0 reactions 1 assignee Claimed by @eye-gu View on GitHub
type: bug
Dominant language
Java
Stars
8.8k
Forks
3.1k
Avg merge
7d 1h
Merged PRs (30d)
85

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Current Behavior

https://github.com/apache/shenyu/blob/6e79c7b7c3f62163d82a7775593de49f95dae754/shenyu-plugin/shenyu-plugin-httpclient/src/main/java/org/apache/shenyu/plugin/httpclient/AbstractHttpClientPlugin.java#L80

When retry is enabled (retryTimes > 0) for HTTP proxy rules, retry attempts send an empty request body to the upstream instead of the original body.

The root cause: exchange.getRequest().getBody() returns a single-use FluxReceive from Reactor Netty. After the first doRequest consumes it, the underlying ByteBufs are released. Subsequent retry subscriptions get an exhausted stream that immediately completes — the upstream receives an empty body with no error, causing silent data loss.

### Expected Behavior

_No response_

### Steps To Reproduce

_No response_

### Environment

```markdown
ShenYu version(s):
```

### Debug logs

_No response_

### Anything else?

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.