shenyu icon indicating copy to clipboard operation
shenyu copied to clipboard

[BUG] Websocket Sync Error

Open moremind opened this issue 5 years ago • 10 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current Behavior

1.I added two divide plugins, image

2.I close first divide plugin image 3.I try to sync plugin data,oooo,occur error image

com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:224)
	at com.google.gson.Gson.fromJson(Gson.java:887)
	at com.google.gson.Gson.fromJson(Gson.java:852)
	at com.google.gson.Gson.fromJson(Gson.java:801)
	at com.google.gson.Gson.fromJson(Gson.java:773)
	at org.apache.shenyu.common.utils.GsonUtils.fromJson(GsonUtils.java:123)
	at org.apache.shenyu.plugin.divide.handler.DividePluginDataHandler.lambda$handlerRule$0(DividePluginDataHandler.java:32)
	at java.util.Optional.ifPresent(Optional.java:159)
	at org.apache.shenyu.plugin.divide.handler.DividePluginDataHandler.handlerRule(DividePluginDataHandler.java:31)
	at org.apache.shenyu.plugin.base.cache.CommonPluginDataSubscriber.lambda$null$5(CommonPluginDataSubscriber.java:141)
	at java.util.Optional.ifPresent(Optional.java:159)
	at org.apache.shenyu.plugin.base.cache.CommonPluginDataSubscriber.lambda$subscribeDataHandler$7(CommonPluginDataSubscriber.java:141)
	at java.util.Optional.ifPresent(Optional.java:159)
	at org.apache.shenyu.plugin.base.cache.CommonPluginDataSubscriber.subscribeDataHandler(CommonPluginDataSubscriber.java:118)
	at org.apache.shenyu.plugin.base.cache.CommonPluginDataSubscriber.onRuleSubscribe(CommonPluginDataSubscriber.java:96)
	at java.util.ArrayList.forEach(ArrayList.java:1257)
	at org.apache.shenyu.plugin.sync.data.websocket.handler.RuleDataHandler.doRefresh(RuleDataHandler.java:42)
	at org.apache.shenyu.plugin.sync.data.websocket.handler.AbstractDataHandler.handle(AbstractDataHandler.java:68)
	at org.apache.shenyu.plugin.sync.data.websocket.handler.WebsocketDataHandler.executor(WebsocketDataHandler.java:59)
	at org.apache.shenyu.plugin.sync.data.websocket.client.ShenyuWebsocketClient.handleResult(ShenyuWebsocketClient.java:88)
	at org.apache.shenyu.plugin.sync.data.websocket.client.ShenyuWebsocketClient.onMessage(ShenyuWebsocketClient.java:68)
	at org.java_websocket.client.WebSocketClient.onWebsocketMessage(WebSocketClient.java:591)
	at org.java_websocket.drafts.Draft_6455.processFrameText(Draft_6455.java:885)
	at org.java_websocket.drafts.Draft_6455.processFrame(Draft_6455.java:819)
	at org.java_websocket.WebSocketImpl.decodeFrames(WebSocketImpl.java:379)
	at org.java_websocket.WebSocketImpl.decode(WebSocketImpl.java:216)
	at org.java_websocket.client.WebSocketClient.run(WebSocketClient.java:508)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $
	at com.google.gson.stream.JsonReader.beginObject(JsonReader.java:385)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:213)
	... 27 common frames omitted

Expected Behavior

No response

Steps To Reproduce

No response

Environment

ShenYu version(s):V2.4.0--last month

Debug logs

No response

Anything else?

No response

moremind avatar Sep 06 '21 12:09 moremind

hi, @moremind ,thanks for your report, would you like to fix it? and pull request.

midnight2104 avatar Sep 06 '21 14:09 midnight2104

I think , divide selector handler is null ?

yu199195 avatar Sep 07 '21 01:09 yu199195

I think , divide selector handler is null ?

No,I only open a selector with selector handler,from the log,I think this question related to plugin rule?

moremind avatar Sep 07 '21 03:09 moremind

No,I only open a selector with selector handler,from the log,I think this question related to plugin rule?

is selector handler field is null

yu199195 avatar Sep 07 '21 03:09 yu199195

@moremind can you fix it?

yu199195 avatar Sep 09 '21 03:09 yu199195

@moremind Hello bro, have you done it yet?

babynata avatar Sep 14 '21 01:09 babynata

@moremind can you fix it?

ooooh,Sorry,I have no time doing it, I may fix it after a month.

moremind avatar Sep 14 '21 04:09 moremind

@moremind Hello bro, have you done it yet?

ooooh,Sorry,I have no time doing it, I may fix it after a month.

moremind avatar Sep 14 '21 04:09 moremind

@yu199195 I test again,shenyu-2.4.1 can't find this bug?

moremind avatar Sep 14 '21 07:09 moremind

@moremind

i do not find this bug .

1

yu199195 avatar Sep 14 '21 07:09 yu199195