Aias00 opened a new issue, #6843:
URL: https://github.com/apache/shenyu/issues/6843

   ## Description
   `ShenyuWebsocketClient.onMessage` has no try-catch. It calls 
`GsonUtils.fromJson(result, WebsocketData.class)` (throws `JsonSyntaxException` 
on malformed JSON), then 
`ConfigGroupEnum.acquireByName(websocketData.getGroupType())` (throws 
`ShenyuException` for unknown/null groupType via `orElseThrow`), and 
`DataEventTypeEnum.acquireByName` (likewise). None are caught; the exception 
propagates to java-websocket's reader thread.
   
   ## Location
   - 
`shenyu-sync-data-center/shenyu-sync-data-websocket/src/main/java/org/apache/shenyu/plugin/sync/data/websocket/client/ShenyuWebsocketClient.java:189-207,267-274`
   - 
`shenyu-sync-data-center/shenyu-sync-data-websocket/src/main/java/org/apache/shenyu/plugin/sync/data/websocket/handler/AbstractDataHandler.java:69`
   
   ## Impact
   A single malformed or version-mismatched message throws an uncaught 
exception in the websocket reader thread, which can die, leaving the connection 
apparently open but silently unable to receive further messages. All subsequent 
config changes are lost until the healthCheck reconnects (up to 10 s later).
   
   ## Suggested fix
   Wrap `onMessage` body in try-catch; log and drop malformed/unknown messages 
without killing the reader thread.
   
   ## Related existing
   Distinct from #6568 (`sendMessageBySession` synchronized) and SYNC-10 
(#6785, `WebsocketSyncDataService.masterCheck`).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to