redlsz opened a new issue, #7740: URL: https://github.com/apache/rocketmq/issues/7740
### 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 centos7 ### RocketMQ version 4.9.x | 5.1.x ### JDK Version JDK 1.8 ### Describe the Bug <img width="2409" alt="image" src="https://github.com/apache/rocketmq/assets/103550934/d2f1a0bb-b7b6-4af4-b6ce-71b6281b4a8a"> We encountered a issue that the BROADCASTING DefaultMQPushConsumer was unable to consume: As shown in the log, the client received the OFFSET_ILLEGAL response returned by the broker and kept trying to fix nextOffset but failed, resulting in the inability to consume messages. 我们遇到了一个 Push 消费者广播模式无法消费的问题:如日志所显示,客户端收到了服务端返回的 OFFSET_ILLEGAL,一直在尝试纠正 nextOffset 但始终不能成功,导致无法消费。 ### Steps to Reproduce 1. Create a topic and produce certain messages. 2. Wait for message to expire (queue minOffset >0). 3. Create a subscription group and start a DefaultMQPushConsumer (MessageModel=BROADCASTING, ConsumeFromWhere=CONSUME_FROM_FIRST_OFFSET). 4. Produce more messages. ### What Did You Expect to See? Normal message consumption. ### What Did You See Instead? The consumer is unable to consume any messages. ### Additional Context <img width="1670" alt="image" src="https://github.com/apache/rocketmq/assets/103550934/471d7b87-6552-4ea9-9b11-9a2002e9e7e1"> <img width="780" alt="image" src="https://github.com/apache/rocketmq/assets/103550934/faa1b6cc-d6f2-48c6-bdc7-e153b00374d7"> <img width="1261" alt="image" src="https://github.com/apache/rocketmq/assets/103550934/a29222d4-bf7e-407d-a191-61ce3b5fa35e"> Possible cause we located after reviewing code: When the consumer handles OFFSET_ILLEGAL error, it will first set the correct nextOffset returned by the broker as the consumerOffset (in memory), and then delete the PQ corresponding to the MQ. When the next time the rebalance is triggered, it is expected to set the new consumerOffset as the nextOffset, reinitialize PQ and start pulling messages. But at this time the consumerOffset is read from the store (ReadOffsetType=READ_FROM_STORE), so it will always get -1. As a result, the client will fall into an infinite loop of the above process. 消费端在处理 OFFSET_ILLEGAL 时,首先会将服务端返回的正确的 nextOffset 更新为消费位点(内存),接着删除 MQ 对应的 PQ。下次重平衡触发时,预期是将新的消费位点作为 nextOffset 重新初始化 PQ 并开始拉取消息。但此时是从持久化介质读取消费位点 (ReadOffsetType=READ_FROM_STORE),因此永远只会读到 -1。于是,客户端会陷入上述过程的无限循环中。 -- 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-unsubscr...@rocketmq.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org