Problem
LocalMessageService.popMessage(...) assumes that broker POP response metadata is internally consistent when startOffsetInfo is present:
int index = sortMap.get(key).indexOf(messageExt.getQueueOffset());
Long msgQueueOffset = msgOffsetInfo.get(key).get(index);
...
ExtraInfoUtil.buildExtraInfo(startOffsetInfo.get(key), ...)
If msgOffsetInfo is missing, does not contain the key, has fewer offsets than the decoded messages, or sortMap cannot find the message offset, Proxy can throw NullPointerException or IndexOutOfBoundsException while translating the local broker response.
Expected behavior
Proxy should treat incomplete POP offset metadata as an invalid message entry, log a useful message summary, skip that entry, and keep processing the rest of the response instead of failing the whole local POP request.
Scope
Track 2 / Proxy runtime diagnostics and POP robustness. This only adds defensive handling for malformed broker POP metadata in local mode and should not change valid POP response handling.
Evidence
proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java
- The code dereferences
sortMap.get(key), msgOffsetInfo.get(key), and startOffsetInfo.get(key) without checking missing keys or invalid indexes.
Problem
LocalMessageService.popMessage(...)assumes that broker POP response metadata is internally consistent whenstartOffsetInfois present:If
msgOffsetInfois missing, does not contain the key, has fewer offsets than the decoded messages, orsortMapcannot find the message offset, Proxy can throwNullPointerExceptionorIndexOutOfBoundsExceptionwhile translating the local broker response.Expected behavior
Proxy should treat incomplete POP offset metadata as an invalid message entry, log a useful message summary, skip that entry, and keep processing the rest of the response instead of failing the whole local POP request.
Scope
Track 2 / Proxy runtime diagnostics and POP robustness. This only adds defensive handling for malformed broker POP metadata in local mode and should not change valid POP response handling.
Evidence
proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.javasortMap.get(key),msgOffsetInfo.get(key), andstartOffsetInfo.get(key)without checking missing keys or invalid indexes.