shenyu icon indicating copy to clipboard operation
shenyu copied to clipboard

[BUG] websocket closed refresh data from admin clean plugin local memory

Open zhaowei85 opened this issue 2 years ago • 1 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current Behavior

when the websocket connection closed between admin and bootstrap, bootsrap refresh local cache data from the admin resend rule data,in this stage, the local cache data is been cleared first and restore one by one ,when the request is arrived this time , we can't find the plugin cache and throw error because we don't finish the cache data refreshing

Expected Behavior

the refresh cache data staging need reconstructing. can't clear cache data first,we should friendly for the current requesting to the bootstrap

Steps To Reproduce

No response

Environment

ShenYu version(s):2.6.1

Debug logs

No response

Anything else?

No response

zhaowei85 avatar Jun 17 '24 02:06 zhaowei85

I checked current upstream/master (09c6a528). The WebSocket MYSELF path still calls refreshPluginDataSelf(dataList) before iterating onSubscribe in PluginDataHandler#doRefresh; CommonPluginDataSubscriber.refreshPluginDataSelf delegates to BaseDataCache.cleanPluginDataSelf, which removes each incoming plugin entry. The selector and rule handlers use the same clear-then-apply order. Admin sends the namespace's plugin, selector, and rule lists as separate MYSELF messages from syncAllByNamespaceId, so an in-flight request can observe a missing entry while a group is being applied.

I also found the earlier attempted fix in closed PR #6381. It is not merged, and its description calls out a selector/rule cleanup-granularity limitation, so I do not want to reapply it unchanged.

Could you confirm whether this still reproduces on a current 2.7.x build, and whether MYSELF should be treated as an authoritative per-group snapshot for that gateway namespace? That determines how the refresh should retain the old cache during application and reconcile entries absent from the new snapshot.

sunnysabor avatar Oct 01 '26 23:10 sunnysabor