Skip to content

[Bug] topic首次创建时,实例无法消费消息 #9535

@lehug

Description

@lehug

Before Creating the Bug Report

  • I found a bug, not just asking a question, which should be created in GitHub Discussions.

  • I have searched the GitHub Issues and GitHub Discussions of this repository and believe that this is not a duplicate.

  • I have confirmed that this bug belongs to the current repository, not other repositories of RocketMQ.

Runtime platform environment

ubuntu server 24.04

RocketMQ version

5.2.0 and 5.3.3

JDK Version

1.8

Describe the Bug

通过5.2.0创建了一条新的topic下面的新消息

2025-07-10 19:39:29.672 [1752147569146_182] INFO 10788 --- [ublicExecutor_1] PLATFORM.MQ.HISTORY : PRODUCE;SUCCESS;{"messageId":"7F0000012A2418B4AAC2329117EB0000","messageKey":"7f00000100002a24686fa67100000001","topic":"dev_zcstest2","keys":[],"tags":[],"properties":{"data":"12345","shTraceId":"1752147569146_182"},"delayLevel":0,"deliveryCount":0,"createTime":"2025-07-10 19:39:29+0800"}
2025-07-10 19:39:29.673 [1752147569146_182] INFO 10788 --- [ublicExecutor_1] PLATFORM.MQ.TRACE : PRODUCE;SUCCESS;id=7F0000012A2418B4AAC2329117EB0000;key=7f00000100002a24686fa67100000001;topic=dev_zcstest2;dcnt=0

用 5.2.0的mqadmin查不到数据
root@sh:/data/middlewares/rocketmq-all-5.2.0-bin-release/bin# ./mqadmin queryMsgById -n localhost:9876 -i 7F0000012A2418B4AAC2329117EB0000
org.apache.rocketmq.tools.command.SubCommandException: QueryMsgByIdSubCommand command failed
at org.apache.rocketmq.tools.command.message.QueryMsgByIdSubCommand.execute(QueryMsgByIdSubCommand.java:271)
at org.apache.rocketmq.tools.command.MQAdminStartup.main0(MQAdminStartup.java:164)
at org.apache.rocketmq.tools.command.MQAdminStartup.main(MQAdminStartup.java:114)
Caused by: org.apache.rocketmq.client.exception.MQClientException: CODE: 208 DESC: query message by id finished, but no message.
For more information, please visit the url, https://rocketmq.apache.org/docs/bestPractice/06FAQ
at org.apache.rocketmq.client.impl.MQAdminImpl.viewMessage(MQAdminImpl.java:271)
at org.apache.rocketmq.tools.admin.DefaultMQAdminExtImpl.viewMessage(DefaultMQAdminExtImpl.java:1720)
at org.apache.rocketmq.tools.admin.DefaultMQAdminExt.viewMessage(DefaultMQAdminExt.java:151)
at org.apache.rocketmq.tools.command.message.QueryMsgByIdSubCommand.queryById(QueryMsgByIdSubCommand.java:49)
at org.apache.rocketmq.tools.command.message.QueryMsgByIdSubCommand.execute(QueryMsgByIdSubCommand.java:265)
... 2 more

用 5.3.3的 mqadmin查询的是已消费
root@sh:/data/middlewares/rocketmq-all-5.3.3-bin-release/bin# ./mqadmin queryMsgById -n localhost:9876 -i 7F0000012A2418B4AAC2329117EB0000 -t dev_zcstest2
OffsetID: C0A8027B00002A9F000000001909BBD0
Topic: dev_zcstest2
Tags: [null]
Keys: [null]
Queue ID: 3
Queue Offset: 0
CommitLog Offset: 420068304
Reconsume Times: 0
Born Timestamp: 2025-07-10 19:39:29,643
Store Timestamp: 2025-07-10 19:39:30,210
Born Host: 192.168.2.18:58551
Store Host: 192.168.2.123:10911
System Flag: 0
Properties: {data=12345, MSG_CREATE_TIME=2025-07-10 19:39:29344+0800, MSG_KEY=7f00000100002a24686fa67100000001, MSG_REGION=DefaultRegion, UNIQ_KEY=7F0000012A2418B4AAC2329117EB0000, CLUSTER=DefaultCluster, DELAY=0, TRACE_ON=true, shTraceId=1752147569146_182}
Message Body Path: /tmp/rocketmq/msgbodys/7F0000012A2418B4AAC2329117EB0000

MessageTrack [consumerGroup=sh-master-consume-dev-zcs, trackType=CONSUMED, exceptionDesc=null]

此topic下第二条消息,就可以正常消费。

另外通过 5.3.3发送消息也验证了,创建新的topic时,第一条消息不能被消费。

Steps to Reproduce

默认的单例启动,ExecStart=/data/middlewares/rocketmq-all-5.2.0-bin-release/bin/mqbroker -n localhost:9876 --enable-proxy

业务系统,创建一个新的topic下面的消息,然后同一个java项目监听,收不到消息

What Did You Expect to See?

正常收到创建topic时的消息

What Did You See Instead?

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions