[BUG] Cold-data flow control NPEs for pull requests whose group is only in the compensation table - #11095
Open
zjncs wants to merge 1 commit into
Open
[BUG] Cold-data flow control NPEs for pull requests whose group is only in the compensation table#11095zjncs wants to merge 1 commit into
zjncs wants to merge 1 commit into
Conversation
…cold-data flow-control path The cold-data flow-control branch of PullMessageProcessor read the consume type with ConsumerManager.getConsumerGroupInfo(group), which only sees the live consumer table. Pull requests that carry their subscription (proxy / lite-pull traffic) never registered the group there, so once the group is flagged for cold-data flow control and the pulled offset is cold, the processor dereferenced null and failed the request with an NPE. The group's basic info (consume type, message model) is already compensated into consumerCompensationTable a few lines earlier for exactly these pull styles, so read it with getConsumerGroupInfo(group, true) like ConsumerLagCalculator does, and fall back to the passive flow-control response if even the compensation table has no record. Signed-off-by: zjncs <18910855655@163.com>
RockteMQ-AI
approved these changes
Sep 9, 2026
RockteMQ-AI
left a comment
Contributor
There was a problem hiding this comment.
Summary
Uses getConsumerGroupInfo(group, true) to also consult the compensation table when looking up consumer group info for cold-data flow control — prevents NPE when the group exists only in the compensation table. Falls back to CONSUME_PASSIVELY if the group is not found anywhere, which is the safe default. Well-documented with a thorough regression test.
LGTM.
Automated review by github-manager-bot
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.
Motivation
When a broker has
coldDataFlowControlEnable=trueand a consumer group is flagged for cold-data flow control (ColdDataCgCtrService), the cold branch ofPullMessageProcessordoes:getConsumerGroupInfo(group)only consults the live consumer table. But pull requests that carry their subscription in the request (proxy / lite-pull traffic, i.e.hasSubscriptionFlag=true\)) never registered the group there — the broker instead compensates the group's basic info intoconsumerCompensationTablea few lines earlier (compensateBasicConsumerInfo,PullMessageProcessor` L381-392). For those requests the lookup returns null and the pull thread dies with:So a flow-controlled group reading cold data via the proxy gets NPE responses instead of the intended flow control.
Changes
getConsumerGroupInfo(group, true)so the compensation table filled a few lines above is also consulted (same pattern asConsumerLagCalculator).CONSUME_PASSIVELY— the conservative flow-control response — instead of dereferencing null.Verification
New test
PullMessageProcessorTest#testColdDataFlowCtrWhenGroupIsOnlyInCompensationTable: enables cold-data flow control, flags the group viacoldAcc, unregisters the live consumer, mocks aDefaultMessageStorewhose commit log reports the offset as cold, and sends a subscription-carrying pull request.