Skip to content

[BUG] Clearing rule handles leaves previous transformations active in gateway caches #7759

Closed

Description

@Aias00

Current behavior

Updating an existing rule to handle: "" persists a non-null empty string and publishes a rule UPDATE, but multiple gateway rule handlers keep their previous cached configuration:

  1. The empty string passes Optional.ofNullable(handle).
  2. GsonUtils.fromJson("", Handle.class) returns null.
  3. CommonHandleCache.cachedHandle(key, null) ignores the write rather than removing the existing entry.
  4. Plugin execution still obtains and applies the previous handle.

Locations / reachable update path

This is explicitly an empty-string update, not an omitted/null field that intentionally retains its database value during a selective update.

Reproduction / validation

A probe compiled the current RequestPlugin, RequestHandle, affected data handlers and CommonHandleCache. It configured a header mutation, updated the same rule to an empty handle, and executed the actual RequestPlugin doExecute() path. A {} update is the passing clear/no-op control:

HANDLE={"header":{"setHeaders":{"X-Old":"still-active"}}} X-Old=still-active
HANDLE=<empty> X-Old=still-active
HANDLE={} X-Old=null
GSON_EMPTY_IS_NULL=true
REWRITE_OLD_HANDLE_RETAINED=true
MODIFY_RESPONSE_OLD_HANDLE_RETAINED=true
PARAM_MAPPING_OLD_HANDLE_RETAINED=true

The latter three controls seed a real handle via each actual handler and verify the same object remains after the empty update. Independent reviewers traced the Admin persistence/event path and corrected an initial mistaken assumption that Gson returns a default object for an empty string. No deployed Admin/database/gateway integration was run; persistence and event propagation are source-confirmed, while handler/cache/request behavior is executed.

Impact / suggested fix

Operators can clear a rule's stored configuration while gateways continue applying old request/header/path/body transformations until a later valid handle update or cache reset. Treat an explicitly cleared handle as a cache eviction or normalized empty configuration, and keep all affected handlers consistent. Preserve the distinction between explicit empty clears and omitted fields in selective Admin updates; do not turn every missing DTO field into a runtime clear.

Related existing work

#6772/#6880 concern removeRule deletion callbacks, whereas this is the UPDATE path. #7750 concerns selector logging sampling after {}, not rule-handle parsing. #6507 concerns partial RequestHandle fields, and #4142 is an old frontend JWT-handle editing symptom. The four same-root handlers are grouped here to avoid separate duplicate reports.

Reviewed revision

Apache ShenYu 2.7.2-SNAPSHOT, master@66d7d954ca37d651a5ad916f988a8081157a7ab4. Priority P2 / Medium, high confidence in the described source/runtime behavior. Unit-test and CI issue categories excluded.

Activity

  1. added a commit that references this issue on Oct 19, 2026
    0423556
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions