Fix stale exception assertion in DeserializingConnectionCallbackTest - #9081
Merged
rzo1 merged 1 commit intoSep 10, 2026
Merged
Conversation
PR apache#9075 added a guard to SerializableSerializer.read() that rejects a negative java-serialized length with a KryoException before allocating the array, so the negative-length payload no longer reaches `new byte[len]` and NegativeArraySizeException is never thrown. Update testJavaFallbackNegativeLengthDroppedAndBatchContinues (added in apache#9076) to expect the KryoException the hardened path now throws, and correct the stale comment. KryoException is already a tolerated drop reason, so the batch-continues assertion is unaffected. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.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
DeserializingConnectionCallbackTest.testJavaFallbackNegativeLengthDroppedAndBatchContinuesfails on current master (e.g. run #9080, and on plain master runs), breaking thetest (25, Client, ...)CI job.Root cause
0xFFand expectedSerializableSerializer.read()to reachnew byte[len]and throwNegativeArraySizeException.SerializableSerializer.read()that rejects a negative length with aKryoExceptionbefore the array is allocated. The deadNegativeArraySizeExceptionpath can no longer be hit, but the test assertion was not updated.Change
KryoException(the exception the hardened path now throws) instead ofNegativeArraySizeException.KryoExceptionis already a tolerated deserialization-failure/drop reason (the siblingtestTruncatedKryoPayloadDroppedAndBatchContinuesasserts it and reuses the sameassertBatchDeliversOnlyValidMessageshelper), so the batch-continues assertion is unaffected.Verification
Ran the class locally on JDK 25:
Tests run: 10, Failures: 0, Errors: 0— including the previously failing test.🤖 Generated with Claude Code