[Bug] Bare lock busy-wait without yield in ack/changeInvisibleTime processors pins ack executor threads
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- java
調査の方向性
Read the listed lock loops in AckMessageProcessor.java and ChangeInvisibleTimeProcessor.java, then compare them with PopConsumerService#tryLockForPop and the ackMessageExecutor registration in BrokerController.java. Check the linked pull request #11384 for current work. Done means the listed contended paths yield while preserving their lock behavior.
索引モデルが issue の本文から書いたものです。
説明
Before Creating the Bug Report
- I found a bug. The issue list contains no issue matching my bug.
Your Environment
- RocketMQ version: 5.4.x (current develop)
Describe the Bug
Several pop/ack paths acquire the consumer/queue lock with a bare busy-wait that has no Thread.yield():
AckMessageProcessor#ackOrderly—while (!queueLockManager.tryLock(lockKey)) {}(broker/src/main/java/org/apache/rocketmq/broker/processor/AckMessageProcessor.java:405)AckMessageProcessor#ackOrderly(KV service path) —while (!consumerLockService.tryLock(consumeGroup, topic)) {}(AckMessageProcessor.java:448)AckMessageProcessor#ackLite—while (!consumerLockService.tryLock(lockKey)) {}(AckMessageProcessor.java:538)ChangeInvisibleTimeProcessor#changeInvisibilityDuration— same shape (ChangeInvisibleTimeProcessor.java:203, :235, :389)
All of these are registered on the shared ackMessageExecutor (BrokerController.java:1204-1213), so each contending request pins one worker thread at 100% CPU for the entire contention window:
- Under a
(group, topic)contention burst, several executor workers can be stuck spinning at once, cutting the executor's effective parallelism for every other ack / changeInvisibleTime request on the broker. - On core-saturated brokers the spinning threads compete for CPU with the very lock holders that must finish for the spin to exit, extending the wait beyond the actual critical-section length.
The codebase already establishes the correct pattern for this lock service: PopConsumerService#tryLockForPop (added by #10828) spins with Thread.yield() and a comment explaining why the spin is kept — same consumerLockService, same contention shape, but it yields.
Steps to Reproduce
Code inspection + any workload where two consumers of the same group ack/changeInvisibleTime concurrently for the same topic: the losing request's thread spins in the while loop with no yield until the holder releases (or PopConsumerLockService.removeTimeout() self-heals a stale entry).
What Did You Expect to See?
The spin semantics preserved (these paths must hold the lock to commit offsets atomically) but with Thread.yield() in the loop, matching tryLockForPop — so a contending worker yields its core to the holder instead of burning it.
Additional Context
None
- 主要言語
- Java
- スター
- 22.7k
- フォーク
- 12k
- 平均マージ
- 4日 20時間
- マージ済み PR(30日)
- 11
環境構築
- 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 が 30 日前に担当しました。 オープン
難易度 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 日以内に返信
-
[BUG]: Java SDK MountRequest always sends update-optional fields, resetting stored mount settingsオープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 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 日以内に返信