[ISSUE #10990] Skip pop retry arrival notification when properties are null - #10994
[ISSUE #10990] Skip pop retry arrival notification when properties are null#10994unbridled-41 wants to merge 1 commit into
Conversation
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
This PR adds a defensive null check for the properties parameter in notifyMessageArrivingFromRetry, preventing potential NPE when retry topic messages arrive without properties (e.g., from non-Java clients). The fix is minimal, well-commented, and includes a test case.
LGTM — code changes look good.
Automated review by github-manager-bot
Test evidence (before → after)
On the unfixed code (fix reverted, test kept): That is exactly the NPE the reput thread hits: With this PR: For consistency reference: Side note on CI: the workflow runs for this PR are in |
Which Issue(s) This PR Fixes
Brief Description
PopLongPollingService#notifyMessageArrivingFromRetrydereferences the dispatch request's properties map without a null check:A
DispatchRequestlegitimately carries a null properties map (MessageDecoder.string2messagePropertiesreturns null for a message stored without properties — e.g. written by a non-Java client on a%RETRY%-prefixed topic). The store's own code acknowledges nullability:DefaultMessageStore#notifyMessageArrive4MultiQueueguardsprop == nullandPullRequestHoldService#notifyMessageArrivingguardsproperties != null— only the pop retry branch misses it.The blast radius is broker-wide: the listener is invoked from
DefaultMessageStore.ReputMessageService#doReputbeforereputFromOffsetis advanced, anddoReputonly catchesRocksDBException. The NPE propagates toServiceThread.run, which logs and loops — then re-reads the same commitlog record and throws again forever, so all dispatch stops (consume queues stop advancing, consumers see a full outage) until manual intervention, and the poison message survives restarts.This PR returns early when
properties == null: a retry-topic message without properties cannot be mapped back to an origin group, so there is no long-polling request to wake up. This matches the guards used by the sibling listeners.How Did You Test This Change?
Added
PopLongPollingServiceTest#testNotifyMessageArrivingFromRetryWithoutProperties, which invokesnotifyMessageArrivingWithRetryTopicon a%RETRY%topic with a null properties map. It throws NPE on the unfixed code and passes (no wake-up) with this change.mvn -pl broker test -Dtest=PopLongPollingServiceTestpasses (13/13).