[Bug] Timer metrics check logs Offset not matched for Long.MAX_VALUE when no eligible timer slot exists
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 64/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- java
調査の方向性
Read TimerMessageStore.checkAndReviseMetrics() and TimerWheel.checkPhyPos() in the store timer package, then inspect the existing timer store tests for metrics reconciliation and timer wheel lookups. Add regression coverage for an empty eligible wheel range and a valid slot; done means the empty range avoids a lookup at Long.MAX_VALUE, valid-slot behavior still works, and zero-count metrics reconciliation is preserved.
索引モデルが issue の本文から書いたものです。
説明
Runtime platform environment
Linux ARM64 (Kylin); isolated boundary probe also run on Windows x64.
RocketMQ version
5.5.1, using the official 5.5.1 store JAR. The deployed Proxy has an unrelated null-Settings guard; no Broker/store code was modified.
JDK Version
Production: JDK 17.0.19. Local isolated probe: JDK 17.0.18.
Describe the Bug
The scheduled TimerMessageStore.checkAndReviseMetrics() can emit a misleading Offset not matched warning when the timer wheel has no eligible slot but a TimerLog mapped file still exists.
Sanitized observed log:
WARN TimerScheduledThread1 - Offset not matched. Request offset: 9223372036854775807, firstOffset: 0, lastOffset: 104857600, mappedFileSize: 104857600, mappedFiles count: 1
We observed one warning on each of four Broker processes during the same scheduled metrics-check window. Immediately following logs showed the metric count for rmq_sys_REVIVE_LOG_DefaultCluster revised from 0 to 0, and the task completed in 31–41 ms. Timer processing queues and offset backlog were zero around that window. We have not observed message loss or a delivery stall caused by this warning.
Root cause analysis
TimerWheel.checkPhyPos(readTimeMs, 0)initializesminFirsttoLong.MAX_VALUEand returns that sentinel when no matching slot is found.checkAndReviseMetrics()passes this result directly totimerLog.getWholeBuffer(currOffsetPy)without checking the sentinel.MappedFileQueue.findMappedFileByOffsetlogs the out-of-range warning and returns null.- The metrics scan breaks and performs its usual metrics update.
Steps to Reproduce
The following is a minimal, local-only probe of the boundary call chain, not a full Broker integration test. No Producer or Consumer is started. Run with the official 5.5.1 libraries:
Path root = Files.createTempDirectory("timer-offset-probe-");
TimerWheel wheel = new TimerWheel(root.resolve("timerwheel").toString(), 16, 1000);
TimerLog log = new TimerLog(root.resolve("timerlog").toString(), 104857600);
// Allocate a local file to represent retained TimerLog storage.
log.getMappedFileQueue().getLastMappedFile(0);
long now = System.currentTimeMillis() / 1000 * 1000;
long offset = wheel.checkPhyPos(now, 0);
assert offset == Long.MAX_VALUE;
assert log.getWholeBuffer(offset) == null;
// With the store-error logger enabled, the lookup emits the warning above.
wheel.shutdown();
log.getMappedFileQueue().shutdown(1000);
A local probe with an allocated TimerLog and an empty wheel confirmed the sentinel/null-lookup behavior. A subsequent valid-slot lookup still succeeded. Production logs supply the full scheduled-task observation.
Expected behavior
An empty eligible timer-wheel range should be handled explicitly without attempting a file lookup at Long.MAX_VALUE and without an alarming out-of-range warning. Preserve the existing metrics reconciliation semantics.
Suggested direction
Guard the sentinel before entering the scan loop. Avoid an unconditional early return from the entire method if that would skip the intended zero-count metrics reconciliation. Add empty-wheel and valid-slot regression coverage.
Related reports checked
- #9947 / #9948: BLANK record / BufferUnderflowException.
- #10165: metrics overwritten after timer-engine switch.
- #10668: stale TimerLog references after CommitLog truncation.
These appear to have different triggers from this empty-range sentinel case. Searches forOffset not matched,checkAndReviseMetrics,checkPhyPos, and9223372036854775807did not find an exact duplicate.
Source references
- https://github.com/apache/rocketmq/blob/rocketmq-all-5.5.1/store/src/main/java/org/apache/rocketmq/store/timer/TimerWheel.java
- https://github.com/apache/rocketmq/blob/rocketmq-all-5.5.1/store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java
- https://github.com/apache/rocketmq/blob/rocketmq-all-5.5.1/store/src/main/java/org/apache/rocketmq/store/timer/TimerLog.java
- https://github.com/apache/rocketmq/blob/rocketmq-all-5.5.1/store/src/main/java/org/apache/rocketmq/store/MappedFileQueue.java
The same unguarded scan entry is present in develop at 592d59d12db356f8c98332d9e355a89d92590db3.
- 主要言語
- Java
- スター
- 22.7k
- フォーク
- 12k
- 平均マージ
- 3日 18時間
- マージ済み PR(30日)
- 17
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/rocketmq のほかの issue
-
[Bug] RemotingHelper.connect swaps the socket send and receive buffer configuration対応中かも @amalsaidov が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
CompressionType.of fails under the Turkish locale対応中かも @sharanggupta が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
メンテナーはふだん 1 日以内に返信
-
[rocketmq-client-python] TransactionMQProducer allocates an unused producer during initializationオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
[Bug] notifyMasterOnline aborts the long-polling wake-up with a NullPointerException when an arrival drains a bucket first対応中かも @iloveeyjafjalla が 29 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
apache/rocketmq#11441 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Enhancement] FilterFactory duplicate-registration and unregister semantics lack tests対応中かも @chennaji9 が 34 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
apache/rocketmq#11340 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
apache/rocketmq の issue をすべて見る
似ている issue
-
bug emitter:client:csharp
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
microsoft/typespec#12572 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
GCC 15.2: -Wcast-qual warning - cast discards const qualifier from pointer target type (H5trace.c)オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
メンテナーはふだん 1 日以内に返信
-
needs-area-label
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 2 日以内に返信
-
area/ai area/backend component/zeebe kind/task
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
spAnser/reacharound#38 ·