You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by "Aias00 (via GitHub)" <gi...@apache.org> on 2026/08/04 02:52:27 UTC
[I] [BUG] WebSocket onMessage has no try-catch — malformed/unknown payload kills reader thread [shenyu]
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: notifications-unsubscribe@shenyu.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [BUG] WebSocket onMessage has no try-catch — malformed/unknown payload kills reader thread [shenyu]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #6843:
URL: https://github.com/apache/shenyu/issues/6843#issuecomment-5174051198
👋 Hello @Aias00
A new issue has been opened by @Aias00:
- **Title**: [BUG] WebSocket onMessage has no try-catch — malformed/unknown payload kills reader thread
- **Link**: https://github.com/apache/shenyu/issues/6843
Please review when you have time. Thank you! 🙏
--
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: notifications-unsubscribe@shenyu.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [BUG] WebSocket onMessage has no try-catch — malformed/unknown payload kills reader thread [shenyu]
Posted by "Aias00 (via GitHub)" <gi...@apache.org>.
Aias00 closed issue #6843: [BUG] WebSocket onMessage has no try-catch — malformed/unknown payload kills reader thread
URL: https://github.com/apache/shenyu/issues/6843
--
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: notifications-unsubscribe@shenyu.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [BUG] WebSocket onMessage has no try-catch — malformed/unknown payload kills reader thread [shenyu]
Posted by "hengyuss (via GitHub)" <gi...@apache.org>.
hengyuss commented on issue #6843:
URL: https://github.com/apache/shenyu/issues/6843#issuecomment-5365935508
/assign
--
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: notifications-unsubscribe@shenyu.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org