Close channel on TLS exception to prevent half-open connections#16202
Open
uuuyuqi wants to merge 2 commits intoapache:3.3from
Open
Close channel on TLS exception to prevent half-open connections#16202uuuyuqi wants to merge 2 commits intoapache:3.3from
uuuyuqi wants to merge 2 commits intoapache:3.3from
Conversation
SslServerTlsHandler.exceptionCaught() only logged the error without closing the channel or propagating the exception. This caused channels to remain TCP-active but application-dead when exceptions like NoClassDefFoundError occurred during Netty read loops. Similarly, SslClientTlsHandler did not close the channel on TLS handshake failure, only firing exceptionCaught to downstream handlers. This fix ensures both handlers close the channel on failure, allowing Dubbo's existing health-check mechanism (isAvailable/addInvalidateInvoker) to properly detect and remove broken invokers. Change-Id: Ia466bc4db9e59b1f5c1f01a3062c619aabbbb4e1 Co-developed-by: Cursor <noreply@cursor.com>
Change-Id: Ie3ac6e2e6d1ce5e8f6bd2ad4fe2a5c9286d66fbf Co-developed-by: Cursor <noreply@cursor.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 3.3 #16202 +/- ##
============================================
- Coverage 60.79% 60.78% -0.01%
Complexity 11751 11751
============================================
Files 1953 1953
Lines 89119 89120 +1
Branches 13444 13444
============================================
- Hits 54177 54171 -6
Misses 29368 29368
- Partials 5574 5581 +7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
What is the purpose of the change?
Fixes #16201
SslServerTlsHandler.exceptionCaught()only logged errors without closing the channel or propagating the exception. This caused channels to remain TCP-active but application-dead (half-open) when non-IOException/non-OutOfMemoryError exceptions (e.g.,NoClassDefFoundError) occurred during Netty's read loop.Impact: Consumer-side
DubboInvoker.isAvailable()always returnedtruefor these broken connections (it only checks TCP-levelchannel.isActive()), so theaddInvalidateInvokermechanism never triggered. The broken Provider was never removed fromvalidInvokers, causing continuous RPC timeouts.Changes:
SslServerTlsHandler.exceptionCaught(): Addedctx.close()after logging, consistent with theuserEventTriggered()method in the same class which already closes the channel on TLS handshake failure.SslClientTlsHandler.userEventTriggered(): Changed fromctx.fireExceptionCaught()toctx.close()on handshake failure, consistent with server-side behavior and ensuring the channel is properly closed so the Consumer can detect the failure.Checklist
Made with Cursor