yuz10 opened a new issue, #10108: URL: https://github.com/apache/rocketmq/issues/10108
### 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 4.9.3 ### JDK Version 1.8.0 ### Describe the Bug Broker startup fail in recover. in store.log: ``` 2026-02-24 09:38:29 ERROR main - load exception java.lang.IllegalArgumentException: null at java.nio.Buffer.position(Buffer.java:244) at org.apache.rocketmq.store.MappedFile.selectMappedBuffer(MappedFile.java:410) at org.apache.rocketmq.store.ConsumeQueue.correctMinOffset(ConsumeQueue.java:370) at org.apache.rocketmq.store.DefaultMessageStore.recoverTopicQueueTable(DefaultMessageStore.java:1631) at org.apache.rocketmq.store.DefaultMessageStore.recover(DefaultMessageStore.java:1579) at org.apache.rocketmq.store.DefaultMessageStore.load(DefaultMessageStore.java:260) at org.apache.rocketmq.broker.BrokerController.initialize(BrokerController.java:330) at org.apache.rocketmq.broker.BrokerStartup.createBrokerController(BrokerStartup.java:234) at org.apache.rocketmq.broker.BrokerStartup.main(BrokerStartup.java:59) 2026-02-24 09:38:29 WARN AllocateMappedFileService - AllocateMappedFileService interrupted, possibly by shutdown. 2026-02-24 09:38:29 INFO AllocateMappedFileService - AllocateMappedFileService service end ``` after add some catch and log, the log show that maxReadablePosition is 0. ```java public void correctMinOffset(long minCommitLogOffset) { // Check if the consume queue is the state of deprecation. if (minLogicOffset >= mappedFileQueue.getMaxOffset()) { log.info("ConsumeQueue[Topic={}, queue-id={}] contains no valid entries", topic, queueId); return; } // Check whether the consume queue maps no valid data at all. This check may cost 1 IO operation. // The rationale is that consume queue always preserves the last file. In case there are many deprecated topics, // This check would save a lot of efforts. MappedFile lastMappedFile = this.mappedFileQueue.getLastMappedFile(); if (null == lastMappedFile) { return; } SelectMappedBufferResult lastRecord = null; try { int maxReadablePosition = lastMappedFile.getReadPosition(); try { lastRecord = lastMappedFile.selectMappedBuffer(maxReadablePosition - ConsumeQueue.CQ_STORE_UNIT_SIZE, ConsumeQueue.CQ_STORE_UNIT_SIZE); } catch (Exception e) { ////////////////// new add catch Exception log.warn("ConsumeQueue[topic={}, queue-id={}] selectMappedBuffer pos {} fail.", topic, queueId, maxReadablePosition - ConsumeQueue.CQ_STORE_UNIT_SIZE); } if (null != lastRecord) { ByteBuffer buffer = lastRecord.getByteBuffer(); long commitLogOffset = buffer.getLong(); if (commitLogOffset < minCommitLogOffset) { // Keep the largest known consume offset, even if this consume-queue contains no valid entries at // all. Let minLogicOffset point to a future slot. this.minLogicOffset = lastMappedFile.getFileFromOffset() + maxReadablePosition; log.info("ConsumeQueue[topic={}, queue-id={}] contains no valid entries. Min-offset is assigned as: {}.", topic, queueId, getMinOffsetInQueue()); return; } } } finally { if (null != lastRecord) { lastRecord.release(); } } ``` ### Steps to Reproduce The issue appears after broker shutdown, and then startup ### What Did You Expect to See? The broker should startup successfully ### What Did You See Instead? in store.log: ``` 2026-02-24 09:38:29 ERROR main - load exception java.lang.IllegalArgumentException: null at java.nio.Buffer.position(Buffer.java:244) at org.apache.rocketmq.store.MappedFile.selectMappedBuffer(MappedFile.java:410) at org.apache.rocketmq.store.ConsumeQueue.correctMinOffset(ConsumeQueue.java:370) at org.apache.rocketmq.store.DefaultMessageStore.recoverTopicQueueTable(DefaultMessageStore.java:1631) at org.apache.rocketmq.store.DefaultMessageStore.recover(DefaultMessageStore.java:1579) at org.apache.rocketmq.store.DefaultMessageStore.load(DefaultMessageStore.java:260) at org.apache.rocketmq.broker.BrokerController.initialize(BrokerController.java:330) at org.apache.rocketmq.broker.BrokerStartup.createBrokerController(BrokerStartup.java:234) at org.apache.rocketmq.broker.BrokerStartup.main(BrokerStartup.java:59) 2026-02-24 09:38:29 WARN AllocateMappedFileService - AllocateMappedFileService interrupted, possibly by shutdown. 2026-02-24 09:38:29 INFO AllocateMappedFileService - AllocateMappedFileService service end ``` ### Additional Context _No response_ -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
