Fix false client-termination detection and add channel close observability metrics#3200
Open
amakutunowicz wants to merge 5 commits intolinkedin:masterfrom
Open
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #3200 +/- ##
============================================
+ Coverage 64.24% 69.81% +5.56%
- Complexity 10398 12819 +2421
============================================
Files 840 930 +90
Lines 71755 79148 +7393
Branches 8611 9470 +859
============================================
+ Hits 46099 55257 +9158
+ Misses 23004 20939 -2065
- Partials 2652 2952 +300 ☔ 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.
Summary
This PR improves Netty error handling for client-termination detection and adds observability to distinguish true disconnects from false positives.
Behavioral fixes
500 Internal Server Errorwhen the channel is still active (retryable false-positive path).400 Bad Requestfor accounting only, and short-circuit without any write attempt.500, avoiding accidental 4xx responses to still-connected clients.CLOSE_CONNECTION_ERROR_STATUSES).Observability additions
channelInactivesplit with/without active request.Connection reset,Broken pipe,ClosedChannelException,SSLException, otherIOException).Logging improvements
exceptionCaughtand client-termination logs, including channel active state.Test updates
clientEarlyTerminationTestto assert500on active channel false-positive detection.clientTerminationOnInactiveChannelTest.errorResponseMetricsTest.errorResponseDeliveryMatrixTestcovering 4xx/5xx behavior on active/inactive channels.MockNettyMessageProcessorexpected response status for early client termination on active channel.errorResponseTrackingHeadersTestto correctly handle channel lifecycle based on close policy.Local validation
:ambry-rest:test --tests com.github.ambry.rest.NettyResponseChannelTest✅:ambry-rest:test --tests com.github.ambry.rest.NettyMessageProcessorTest✅:ambry-rest:test✅All tests above were executed with JDK 17 (
/tmp/jdks/temurin17/jdk-17.0.18+8).