fix: avoid KeepAlive NPE when idle fires before WS handshake#30
Open
typefield wants to merge 2 commits into
Open
fix: avoid KeepAlive NPE when idle fires before WS handshake#30typefield wants to merge 2 commits into
typefield wants to merge 2 commits into
Conversation
IdleStateHandler can emit IdleStateEvent after TCP connect but before WebSocket handshake completes. KeepAliveHandler previously dereferenced a null channel field, logging "connection operation failed" and leaving half-dead connections that recovered only after pool retry. Also close the channel in exceptionCaught so the session pool reconnects promptly. Fixes customer intermittent Stream disconnect (Aone 84622857). Co-authored-by: Cursor <cursoragent@cursor.com>
Strengthen regression for Aone 84622857 KeepAlive NPE and ensure NettyClientHandler closes channel on connection failures. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix intermittent
[DingTalk] connection operation failedcaused byNullPointerExceptioninKeepAliveHandler.userEventTriggeredwhenIdleStateEventarrives before WebSocket handshake completes.Related customer ticket: Aone 84622857 (appKey
dingthkn4if9cbyfskxi, stack points toKeepAliveHandler.java:56).Root cause
WebsocketIdleHandlerstarts idle timers after TCP connectKeepAliveHandler.channelis only assigned onHANDSHAKE_COMPLETEchannel.eventLoop()NPENettyClientHandler.exceptionCaughtonly logged and did not close, so pool retry made it look like “retry recovers”Changes
active == true)Channelreference; null/inactive safeactive/channelonchannelInactiveexceptionCaughtto trigger reconnectTest plan
mvn -pl app-stream-network/app-stream-network-ws -am test -Dtest=KeepAliveHandlerTestconnection operation failedNPEMade with Cursor