Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Bug] Fix potential NPE in EscapeBridge when topicPublishInfo is null#10232

Open
Senrian wants to merge 1 commit intoapache:developapache/rocketmq:developfrom
Senrian:fix-npe-escape-bridgeSenrian/rocketmq:fix-npe-escape-bridgeCopy head branch name to clipboard
Open

[Bug] Fix potential NPE in EscapeBridge when topicPublishInfo is null#10232
Senrian wants to merge 1 commit intoapache:developapache/rocketmq:developfrom
Senrian:fix-npe-escape-bridgeSenrian/rocketmq:fix-npe-escape-bridgeCopy head branch name to clipboard

Conversation

@Senrian
Copy link
Copy Markdown

@Senrian Senrian commented Mar 30, 2026

Bug Description

In EscapeBridge.java, the methods asyncPutMessage() and asyncRemotePutMessageToSpecificQueue() call tryToFindTopicPublishInfo() but do not check for a null return value before dereferencing.

Issue: #10216

Location 1 - asyncPutMessage():

final TopicPublishInfo topicPublishInfo = this.brokerController.getTopicRouteInfoManager().tryToFindTopicPublishInfo(messageExt.getTopic());
final MessageQueue mqSelected = topicPublishInfo.selectOneMessageQueue(); // NPE if null

Location 2 - asyncRemotePutMessageToSpecificQueue():

final TopicPublishInfo topicPublishInfo = this.brokerController.getTopicRouteInfoManager().tryToFindTopicPublishInfo(messageExt.getTopic());
List<MessageQueue> mqs = topicPublishInfo.getMessageQueueList(); // NPE if null

Fix

Add null checks consistent with the existing pattern in putMessageToRemoteBroker():

if (null == topicPublishInfo || !topicPublishInfo.ok()) {
    LOG.warn("asyncPutMessage: no route info of topic {}...", ...);
    return CompletableFuture.completedFuture(new PutMessageResult(PutMessageStatus.PUT_TO_REMOTE_BROKER_FAIL, null, true));
}

This prevents NPE when a slave broker acting as master attempts to escape a message for a topic whose route information is not yet available.

Issue: apache#10216

Add null checks for topicPublishInfo in asyncPutMessage() and
asyncRemotePutMessageToSpecificQueue() methods, consistent with
the existing pattern in putMessageToRemoteBroker().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.