[Bug] PD gRPC workers stay held while the leader has no quorum: KV writes, id reads and KV reads wait on the shared hg-grpc pool
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- databases, grpc, java
調査の方向性
Start by reading GRpcServerConfig.configure, RaftKVStore.applyOperation, IdMetaStore.inLeaderTerm, and the ReadIndex paths in KvServiceGrpcImpl; compare how each waits with the shared hg-grpc executor configuration. The issue proposes asynchronous completion, bounded waits, or executor separation, so first trace these paths and decide how they should avoid holding workers during quorum loss. Done means requests needing no quorum remain serviceable during that wait; the payload reports that no quorum-loss test has been run.
索引モデルが issue の本文から書いたものです。
説明
Bug Type (问题类型)
logic (逻辑设计问题)
Before submit
- I have confirmed and searched that there are no similar problems in the historical issue and documents
Environment (环境信息)
- Server Version: PD on
masteratebb8f4e17(1.8.0-SNAPSHOT), and the KV read change of #3383 at its headdb0d771f7 - Backend: PD's raft metadata store (jraft-core 1.3.9)
- OS: any; found by reading the code on 2026-10-22, see "How this was found" below
- Data Size: N/A
Expected & Actual behavior (期望与实际表现)
While a PD leader cannot reach a raft quorum, a request that needs the quorum should fail or be redirected without holding a gRPC worker for long, so the RPCs that need no quorum keep being served.
What happens instead: three request paths wait on a worker of the one shared gRPC executor (hg-grpc) until raft answers, and the executor has a fixed number of workers in front of an unbounded queue.
- The executor.
GRpcServerConfig.configure(lines 37 to 41) installsHgExecutorUtil.createExecutor("hg-grpc", core, max, queue)for the whole PD gRPC server.PDConfig.ThreadPoolGrpcdefaults tothread.pool.grpc.core=600,max=1000andqueue=Integer.MAX_VALUE, which becomes aLinkedBlockingQueueof that capacity (HgExecutorUtil.javalines 101 to 107). AThreadPoolExecutoradds threads above the core size only when the queue is full, so in practice the server has 600 workers, and every request past them waits in the queue. - KV writes wait without a timeout. Every write of
RaftKVStoreblocks onapplyOperation(...).get()with no deadline (RaftKVStore.javalines 76, 99, 109, 119, 128, 138, 157 and 210). Without a quorum the entry does not commit, and the future completes when jraft fails the pending task at step-down (NodeImpl.stepDowncallsballotBox.clearPendingTasks(), which runs each closure withEPERM "Leader stepped down"). - Id reads wait for a ReadIndex.
IdMetaStore.inLeaderTerm(line 108) callswaitReadIndexInTerm, added by #3368, which waits up toraft.rpc-timeout(10 s by default;RaftEngine.waitReadIndex, lines 663 and 690 to 713). - KV
getandscanPrefix(#3383) wait for the same ReadIndex, also up toraft.rpc-timeout(KvServiceGrpcImpl.javalines 166 and 270 atdb0d771f7).
How long a worker is held: PD sets no election timeout, so jraft's default of 1000 ms applies, with a leader lease of 90% of it. A leader that loses its quorum steps down about 1 s later. After that, new requests see isLeader() == false and are redirected without waiting. A write that was waiting is released at the step-down. A ReadIndex that was already waiting (paths 3 and 4) holds its worker until it fails or reaches its 10 s deadline.
So a burst of about 600 requests that arrive in the second before the step-down can occupy every worker. RPCs that need no quorum then queue behind them, for about a second for writes and up to 10 s for reads. Nothing is lost, since the queue is unbounded, but the delay is real. This was raised in the review of #3383 for the KV reads, and paths 2 and 3 show the same holds on master.
One possible direction, for the reads: let the handler return at once and answer from a small executor once the ReadIndex completes. RaftEngine already builds a CompletableFuture for the wait, so it could return that future instead of blocking on it. The write path would need the same treatment, or a deadline. Other directions are a bound on the number of concurrent waits, or a separate executor for the RPCs that need raft.
How this was found
By reading the code at ebb8f4e17 and the jraft-core 1.3.9 sources, on 2026-10-22. No quorum-loss test was run, so the counts and times above come from the configuration defaults and the code paths, not from a measurement.
Vertex/Edge example (问题点 / 边数据举例)
N/A
Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)
N/A
- 主要言語
- Java
- スター
- 3.2k
- フォーク
- 640
- 平均マージ
- 1日 11時間
- マージ済み PR(30日)
- 90
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/hugegraph のほかの issue
-
[Bug] PD task REST: balanceLeaders throws a bare HTTP 500 during the balance-shard window, and task responses cannot be told apart from a no-op or a follower answer対応中かも @pallavithegod が 5 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
apache/hugegraph#3231 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
[Bug] PD raft port accepts jraft CLI membership requests, which bypass the checks of changePeerList and updatePdRaft対応中かも @Mihir-Rabari が 1 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
-
[Bug] RaftEngineReadIndexTest fails now and then with UnfinishedStubbingException: the alive-peers refresher can call the mocked raft node while a test stubs it対応中かも @Mihir-Rabari が 1 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
-
[Bug] PD TTL cleanup deletes the marker-shaped name instead of the expired key, so expired values stay in the store until read対応中かも @bitflicker64 が 1 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
-
[Task] Establish systematic performance baselines and optimization tracking対応中かも @contrueCT が 5 日前に担当しました。 オープンhelp wanted improvement rust
難易度 5/5 1週間以上 初心者へのやさしさ 12/100
apache/hugegraph#3346 · コメント 2 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
apache/hugegraph の issue をすべて見る
似ている issue
-
enhancement feature
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
rsp777/service-pulse-app#28 ·
-
human-required sync-failed
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Azure/osdu-spi-file#63 ·
メンテナーはふだん 1 日以内に返信
-
area/ysql kind/enhancement priority/medium status/awaiting-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
yugabyte/yugabyte-db#35578 ·
メンテナーはふだん 1 日以内に返信
-
frontend quick win
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
CodeForPhilly/benefit-decision-toolkit#571 ·
メンテナーはふだん 1 日以内に返信
-
approved
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
checkstyle/checkstyle#22129 ·
メンテナーはふだん 1 日以内に返信