Skip to content

[BUG] Non-default HTTP retry backoff strategies cannot be selected #6464

Closed

Description

@Aias00

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

The HTTP client plugin appears to support multiple retry backoff strategies (default, fixed, exponential, custom), but current master cannot select any non-default strategy through built-in code.

AbstractHttpClientPlugin reads the strategy type from an exchange attribute:

String retryStrategyType = (String) Optional
    .ofNullable(exchange.getAttribute(Constants.HTTP_RETRY_BACK_OFF_SPEC))
    .orElse(HttpRetryBackoffSpecEnum.getDefault());

However Constants.HTTP_RETRY_BACK_OFF_SPEC is currently defined as the literal string "default", so it is used as the exchange attribute key. I could not find any current code path that writes an exchange attribute with that key. As a result, the code always falls back to HttpRetryBackoffSpecEnum.getDefault() and the fixed / exponential / custom branches are effectively unreachable from built-in configuration.

There is also a hard failure if anything does force the custom branch: CustomRetryStrategy#execute(...) currently returns null, and AbstractHttpClientPlugin immediately calls methods on the returned Mono, causing a NullPointerException.

Expected Behavior

Non-default retry backoff strategies should either be configurable and stored in the exchange under a real attribute key, or the dead strategy branches should be removed/disabled until they are supported.

The custom strategy should not return null; if it is unsupported, it should fail explicitly or be excluded from selection.

Steps To Reproduce

  1. Configure an HTTP route with retry enabled.
  2. Try to select a non-default backoff strategy such as fixed or exponential through the available rule/configuration path.
  3. The HTTP client still uses the default strategy because no built-in code writes exchange.setAttribute(Constants.HTTP_RETRY_BACK_OFF_SPEC, "fixed") or similar.
  4. If an extension manually writes the attribute value custom, CustomRetryStrategy#execute(...) returns null and the request fails with NPE.

Environment

ShenYu version(s): current master

Debug logs

No response

Anything else?

Relevant current-master files:

  • shenyu-common/src/main/java/org/apache/shenyu/common/constant/Constants.java
  • shenyu-plugin/shenyu-plugin-httpclient/src/main/java/org/apache/shenyu/plugin/httpclient/AbstractHttpClientPlugin.java
  • shenyu-plugin/shenyu-plugin-httpclient/src/main/java/org/apache/shenyu/plugin/httpclient/CustomRetryStrategy.java

Activity

  1. github-actions commented on Jul 31, 2026

    @github-actions
    Contributor

    👋 Hello @Aias00

    A new issue has been opened by @Aias00:

    Please review when you have time. Thank you! 🙏

  2. hengyuss commented on Aug 1, 2026

    @hengyuss
    Contributor

    /assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions