Skip to content

fix(httpclient): fail over on upstream server errors - #7097

Merged
Aias00 merged 5 commits into
apache:masterfrom
dengliming:fix-6734-failover-on-upstream-5xx
Sep 30, 2026
Merged

Aias00 merged 5 commits into
apache:masterfrom
dengliming:fix-6734-failover-on-upstream-5xx

Conversation

@dengliming

Copy link
Copy Markdown
Member

Make HTTP client implementations surface upstream 5xx responses as retryable errors when the FAILOVER strategy is active. This lets the existing retry pipeline select another upstream server while preserving current response handling for other retry strategies.

  • add a shared failover status check
  • handle 5xx consistently in WebClient and Reactor Netty clients
  • add regression coverage for WebClient failover behavior

Test: mvn -pl shenyu-plugin/shenyu-plugin-httpclient -am -DskipTests=false -Dcheckstyle.skip=false -Dtest=WebClientPluginTest,NettyHttpClientPluginTest,RetryStrategyTest -DfailIfNoTests=false test

Fixes #6734

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new Reactor Netty failover path lacks regression coverage.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds failover handling for upstream HTTP 5xx responses in both HTTP client implementations.

Changes:

  • Adds a shared failover status predicate and exception.
  • Converts 5xx responses into retryable errors under FAILOVER.
  • Adds WebClient regression coverage.
File summaries
File Description
AbstractHttpClientPlugin.java Adds shared failover status detection.
WebClientPlugin.java Maps failover 5xx responses to errors.
NettyHttpClientPlugin.java Drains 5xx responses and emits retryable errors.
ShenyuUpstreamStatusException.java Defines the upstream status exception.
WebClientPluginTest.java Tests WebClient 5xx failover behavior.
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Aias00
Aias00 previously approved these changes Sep 19, 2026

@Aias00 Aias00 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved as PMC (Aias00). Small, well-scoped fix with regression tests; green CI, mergeable. Reviewed the diff.

@Aias00 Aias00 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed: surfacing upstream 5xx as retryable (ShenyuUpstreamStatusException) so failover triggers correctly is a meaningful resilience fix, applied consistently across the HTTP client implementations and covered by tests. Approving.

@Aias00
Aias00 merged commit 3569a77 into apache:master Sep 30, 2026
20 checks passed
@Aias00 Aias00 added this to the 2.7.2 milestone Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] 5xx upstream responses never trigger failover retry (no error emitted)

3 participants