Repository navigation
[Go] Fix missing return after retry scheduling in process_queue - #1265
Merged
Merged
Conversation
In ackMessage0, changeInvisibleDuration, and forwardToDeadLetterQueue0, when the response code is not OK, the *Later() retry function is called but execution falls through to callback(nil), causing the message to be prematurely evicted from cache before the operation actually succeeds. This can lead to message loss. Add return statements after each *Later() call to prevent fallthrough, matching the Java implementation's behavior where the future is only resolved on terminal states (success or abandoned).
RongtongJin
reviewed
Jun 11, 2026
RongtongJin
left a comment
Contributor
There was a problem hiding this comment.
One inline review comment from my manual review.
| @@ -154,6 +154,7 @@ func (dpq *defaultProcessQueue) forwardToDeadLetterQueue0(mv *MessageView, attem | |||
| " clientId=%s, consumerGroup=%s, messageId=%s, attempt=%d, mq=%s, endpoints=%v, requestId=%s, status message=[%s]", clientId, consumerGroup, messageId, attempt, dpq.mqstr, | |||
| endpoints, requestId, status.GetMessage()) | |||
| dpq.forwardToDeadLetterQueueLater(mv, 1+attempt, callback) | |||
Contributor
There was a problem hiding this comment.
This retry path still does not retry forwarding to the DLQ. With the new return, the message is no longer evicted immediately after scheduling, but forwardToDeadLetterQueueLater currently calls ackMessage0 when the timer fires, and its recover path schedules ackMessageLater. If that ACK succeeds, the callback evicts the message even though it never reached the DLQ. Please make forwardToDeadLetterQueueLater re-enter forwardToDeadLetterQueue0, and have the recover path reschedule forwardToDeadLetterQueueLater.
RongtongJin
approved these changes
Jun 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.
In ackMessage0, changeInvisibleDuration, and forwardToDeadLetterQueue0, when the response code is not OK, the *Later() retry function is called but execution falls through to callback(nil), causing the message to be prematurely evicted from cache before the operation actually succeeds. This can lead to message loss.
Add return statements after each *Later() call to prevent fallthrough, matching the Java implementation's behavior where the future is only resolved on terminal states (success or abandoned).