Skip to content

[BUG] Websocket refresh temporarily removes cached plugin, selector and rule data #7034

Description

@TheoLi0905

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

WebSocket REFRESH and MYSELF handling removes the received Plugin, Selector and Rule entries from the cache, then adds them back one by one.

Request threads read these caches concurrently. Between removal and re-subscription, valid configuration is temporarily unavailable: a plugin may be skipped, or selector/rule matching may fail.

This can happen during synchronization after a WebSocket reconnect or an explicit refresh, even when the configuration has not changed.

Expected Behavior

Refreshing unchanged configuration should not temporarily make it unavailable to requests.

The existing cache should remain readable while the refreshed batch is being built. The completed batch should then become visible in one publication.

Steps To Reproduce

  1. Configure WebSocket data synchronization and a divide route with one matching selector and rule. Confirm that requests succeed.
  2. Trigger synchronization by reconnecting the gateway to Admin.
  3. For deterministic reproduction, pause SelectorDataHandler.doRefresh() immediately after refreshSelectorDataSelf(dataList) and before the subscription loop.
  4. Send a request to the configured route. The selector is temporarily absent from BaseDataCache, so matching fails.
  5. Resume synchronization. The selector is added back and matching succeeds again.

Plugin and Rule refresh handlers contain the same remove-then-add interval.

Environment

ShenYu version(s): 2.7.2-SNAPSHOT
Code baseline: master at 7273f23b7, before the proposed fix
Data synchronization: WebSocket

Debug logs

No response

Anything else?

The proposed fix is limited to removing the temporary cache gap. It preserves entries absent from the received batch and keeps the existing empty-batch behavior, since REFRESH can also contain single-plugin synchronization data.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions