You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "yin-bo-Final (via GitHub)" <gi...@apache.org> on 2026/06/02 12:36:28 UTC
[I] [Bug] PullAPIWrapper throws NPE when class filter topic route data is missing [rocketmq]
yin-bo-Final opened a new issue, #10419:
URL: https://github.com/apache/rocketmq/issues/10419
### Before Creating the Bug Report
- [x] I found a bug, not just asking a question, which should be created in [GitHub Discussions](https://github.com/apache/rocketmq/discussions).
- [x] I have searched the [GitHub Issues](https://github.com/apache/rocketmq/issues) and [GitHub Discussions](https://github.com/apache/rocketmq/discussions) of this repository and believe that this is not a duplicate.
- [x] I have confirmed that this bug belongs to the current repository, not other repositories of RocketMQ.
### Runtime platform environment
ubuntu
### RocketMQ version
develop branch / rocketmq-all-5.5.0
### JDK Version
JDK 8
### Describe the Bug
When a consumer pulls messages with class filter enabled, `PullAPIWrapper#computePullFromWhichFilterServer` may throw a `NullPointerException` if the local topic route table does not contain route data for the target topic.
The current code directly dereferences `topicRouteData`:
```java
TopicRouteData topicRouteData = topicRouteTable.get(topic);
List<String> list = topicRouteData.getFilterServerTable().get(brokerAddr);
If topicRouteData is null, the client throws NPE before reaching the existing business error path.
The method already has a clear fallback exception when no filter server can be found:
throw new MQClientException("Find Filter Server Failed, Broker Addr: " + brokerAddr + " topic: " + topic, null);
So the client should fail with MQClientException instead of exposing a raw NPE.
### Steps to Reproduce
1. Create a PullAPIWrapper.
2. Enable class filter in the pull sys flag.
3. Mock or configure MQClientInstance#getTopicRouteTable() to return a route table that does not contain the target topic, or contains a TopicRouteData without a filter server mapping for the broker address.
4. Call PullAPIWrapper#pullKernelImpl.
5. The call enters computePullFromWhichFilterServer and throws NullPointerException.
### What Did You Expect to See?
The client should fail gracefully with MQClientException, for example: `Find Filter Server Failed, Broker Addr: xxx topic: xxx`
This is consistent with the existing method behavior when no filter server is found.
### What Did You See Instead?
The client may throw NullPointerException from PullAPIWrapper#computePullFromWhichFilterServer before reaching the intended MQClientException branch.
### Additional Context
This problem is caused by method:
`org.apache.rocketmq.client.impl.consumer.PullAPIWrapper#computePullFromWhichFilterServer`
The method currently assumes that topicRouteData is always available before accessing its filter server table. When the route data is missing, it may be better to fall through to the existing MQClientException path instead of throwing NPE.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] PullAPIWrapper throws NPE when class filter topic route data is missing [rocketmq]
Posted by "RongtongJin (via GitHub)" <gi...@apache.org>.
RongtongJin closed issue #10419: [Bug] PullAPIWrapper throws NPE when class filter topic route data is missing
URL: https://github.com/apache/rocketmq/issues/10419
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] PullAPIWrapper throws NPE when class filter topic route data is missing [rocketmq]
Posted by "oss-taishan-ai (via GitHub)" <gi...@apache.org>.
oss-taishan-ai commented on issue #10419:
URL: https://github.com/apache/rocketmq/issues/10419#issuecomment-4620063356
**Issue Evaluation**
Category: | Status: **Confirmed**
The reported issue has been verified against the current codebase.
**Root Cause:** — may return when the local route table lacks an entry for the topic, but the next line dereferences it via , causing NPE.
**Impact:** Triggered when consumer pulls with class-filter enabled but route data is missing/expired/evicted. Client throws raw NPE instead of descriptive .
**Severity:** medium
A fix PR (#10420) has been submitted and reviewed.
---
*Automated evaluation by github-manager-bot*
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] PullAPIWrapper throws NPE when class filter topic route data is missing [rocketmq]
Posted by "RockteMQ-AI (via GitHub)" <gi...@apache.org>.
RockteMQ-AI commented on issue #10419:
URL: https://github.com/apache/rocketmq/issues/10419#issuecomment-4689402604
**Issue Evaluation**
Category: `type/bug` | Status: **Confirmed**
The reported issue has been verified against the codebase description.
**Root Cause:** `PullAPIWrapper#computePullFromWhichFilterServer` directly dereferences `topicRouteData` without null-checking. When the local topic route table lacks an entry for the target topic, `topicRouteTable.get(topic)` returns `null`, causing `NullPointerException` before reaching the intended `MQClientException` fallback path.
**Impact:** Consumer pull operations with class filter enabled. When route data is temporarily unavailable or missing, clients crash with NPE instead of the graceful `MQClientException("Find Filter Server Failed...")` that the method already provides for other error cases.
**Severity:** Medium — affects consumer stability in edge cases where topic route data is incomplete or stale.
**Suggested Fix:** Add null-check for `topicRouteData` before accessing `getFilterServerTable()`. If null, fall through to the existing `MQClientException` throw, maintaining consistency with the method's error handling contract.
```java
TopicRouteData topicRouteData = topicRouteTable.get(topic);
if (topicRouteData == null) {
throw new MQClientException("Find Filter Server Failed, Broker Addr: " + brokerAddr + " topic: " + topic, null);
}
```
An automated fix proposal can be generated. Reply `/approve` to proceed with PR generation.
---
*Automated evaluation by RockteMQ-AI*
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] PullAPIWrapper throws NPE when class filter topic route data is missing [rocketmq]
Posted by "yin-bo-Final (via GitHub)" <gi...@apache.org>.
yin-bo-Final closed issue #10419: [Bug] PullAPIWrapper throws NPE when class filter topic route data is missing
URL: https://github.com/apache/rocketmq/issues/10419
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] PullAPIWrapper throws NPE when class filter topic route data is missing [rocketmq]
Posted by "yin-bo-Final (via GitHub)" <gi...@apache.org>.
yin-bo-Final closed issue #10419: [Bug] PullAPIWrapper throws NPE when class filter topic route data is missing
URL: https://github.com/apache/rocketmq/issues/10419
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] PullAPIWrapper throws NPE when class filter topic route data is missing [rocketmq]
Posted by "oss-taishan-ai (via GitHub)" <gi...@apache.org>.
oss-taishan-ai commented on issue #10419:
URL: https://github.com/apache/rocketmq/issues/10419#issuecomment-4620065740
**Issue Evaluation**
Category: `type/bug` | Status: **Confirmed**
The reported issue has been verified against the current codebase.
**Root Cause:** `PullAPIWrapper.java:301-302` — `topicRouteTable.get(topic)` may return `null` when the local route table lacks an entry for the topic, but the next line dereferences it via `topicRouteData.getFilterServerTable()`, causing NPE.
**Impact:** Triggered when consumer pulls with class-filter enabled but route data is missing/expired/evicted. Client throws raw NPE instead of descriptive `MQClientException("Find Filter Server Failed, ...")`.
**Severity:** medium
A fix PR (#10420) has been submitted and reviewed.
---
*Automated evaluation by github-manager-bot*
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org