Log and meter S3 batch-delete request-body parse failures#3255
Merged
snalli merged 1 commit intoMay 11, 2026
Conversation
The catch in S3BatchDeleteHandler.parseRequestBodyAndDeleteCallback mapped every Exception to a generic MalformedRequestBody S3 error without logging the cause or incrementing any metric. A genuine server-side bug (NPE, IOException, etc.) was indistinguishable from a client sending malformed XML. Add FrontendMetrics.s3BatchDeleteRequestParseError counter, increment it in the catch, and log the exception at WARN. The S3 protocol response (200 OK with XML error body) is unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3255 +/- ##
=============================================
- Coverage 64.24% 51.22% -13.03%
+ Complexity 10398 8666 -1732
=============================================
Files 840 931 +91
Lines 71755 79486 +7731
Branches 8611 9515 +904
=============================================
- Hits 46099 40716 -5383
- Misses 23004 35380 +12376
- Partials 2652 3390 +738 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
satishkotha
approved these changes
May 11, 2026
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.
JIRA: ACTIONITEM-16798
Summary
S3BatchDeleteHandler.parseRequestBodyAndDeleteCallbackcatches everyExceptionthrown while validating the request body and maps it to ageneric
MalformedRequestBodyS3 error. The caught exception is neverlogged, no metric is incremented, and the callback is invoked with a
nullexception argument — so a genuine server-side bug (NPE, IOfailure, deserializer crash, etc.) is operationally indistinguishable
from a client sending malformed XML.
This change:
FrontendMetrics.s3BatchDeleteRequestParseError(Counter).WARNwithlogger.warn("Failed to parse S3 batch-delete request body, returning malformed-body error", e).— that's a protocol requirement.
Testing Done
S3BatchDeleteHandlerTest.malformedXMLRequestTestnow also assertsthe parse-error counter increments by exactly 1 when a malformed body
fires the catch.
S3BatchDeleteHandlerTestpass:./gradlew :ambry-frontend:test --tests "com.github.ambry.frontend.S3BatchDeleteHandlerTest":ambry-frontend:compileJavaand:ambry-frontend:compileTestJavaare clean.Durability risk analysis
No write/metadata/ordering paths touched. This is a pure observability
change in the request-validation path of an S3-compat batch delete
handler. The on-the-wire response is byte-for-byte identical to before.
🤖 Generated with Claude Code