Repository navigation
ARTEMIS-6370 AMQP large message delivery loop on short body - #6916
Open
agagliardi wants to merge 1 commit into
Open
agagliardi wants to merge 1 commit into
agagliardi wants to merge 1 commit into
Conversation
tabish121
reviewed
Nov 17, 2026
An AMQP large message whose stored body is smaller than the body size recorded for it put the broker into an unrecoverable retry loop. The streaming loop in AMQPLargeMessageWriter passed the result of LargeBodyReader.readInto straight into ByteBuf.writerIndex, so the -1 that a sequential file read returns at end of file raised an IndexOutOfBoundsException naming a writerIndex of -1. That reached ProtonServerSenderContext.reportDeliveryError, which removed the consumer and handed the reference back to the queue, so the next consumer to attach failed the same way and the queue logged AMQ222151 indefinitely while delivering nothing. A zero length read had the same cause and spun the loop instead of raising anything. The writer now checks the read before it is used and raises a dedicated ActiveMQAMQPLargeMessageBodyTooSmallException, and the sender sends that one condition to the dead letter address rather than retrying a delivery that can never complete. It goes through ServerConsumer reject so the reference leaves the consumer's delivering list before the link is torn down, because the teardown would otherwise return the message to the queue and the loop would survive. The link is still closed, as a partial transfer may already be on the wire and proton-j cannot abort one. AMQPSessionCallback.disconnect also dereferenced a protocol context that the preceding consumer close clears on the queue executor, so the teardown raised a NullPointerException of its own. It now checks for null the way hasCredits in the same class already does. Assisted-by: Claude Code (Opus 5) on behalf of Antonio Gagliardi
agagliardi
force-pushed
the
ARTEMIS-6370-amqp-large-message-short-body-loop
branch
from
November 18, 2026 13:58
d6bbd0a to
8c8db7a
Compare
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.
Fixes an unrecoverable AMQP large message delivery loop. Details in
ARTEMIS-6370; the short version:
AMQPLargeMessageWriterfedreadInto's end-of-file-1intoByteBuf.writerIndex, raisingIndexOutOfBoundsException: readerIndex: 0, writerIndex: -1; a0length read spun the loop instead.attached afterwards failed the same way — the queue stopped delivering until an operator failed the
broker over.
ActiveMQAMQPLargeMessageBodyExceptionand the sender dead-letters the message rather than retrying,mirroring the
ConversionExceptionbranch already inreportDeliveryError. It usesServerConsumer.rejectso the reference leaves the delivering list before the link teardown, whichwould otherwise put the message back on the queue.
SenderImpl.abort()is ano-op in proton-j 0.35.0.
AMQPSessionCallback.disconnect, which NPE'd on a protocol context that the precedingconsumer close clears asynchronously — the same race as ARTEMIS-5598, at a call site it missed.
New codes:
AMQ119301(the exception) andAMQ111016(WARN when the message is dead-lettered).Tests
Three unit tests in
AMQPLargeMessageWriterTestand a new end-to-endAmqpTruncatedLargeMessageBodyTest; all of them fail without the production changes. With the writerfix reverted, two of the unit tests fail with the exact exception from the field report and the third
hangs to its timeout, demonstrating the zero-read spin.
Claude Code on behalf of Antonio Gagliardi
🤖 Generated with Claude Code