Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[Bug] RaftEngineReadIndexTest fails now and then with UnfinishedStubbingException: the alive-peers refresher can call the mocked raft node while a test stubs it

オープン
#3,384 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@Mihir-Rabari がすでに取り組んでいます。

2026年10月20日 から。

  • #3385 @Mihir-Rabari による — オープン

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
java
領域
databases, testing

調査の方向性

Read RaftEngineReadIndexTest.java around answerShutdown and testStoppedReadServiceClosureThatRunsFirstFailsAsNotLeader, then inspect RaftEngine.startAlivePeersRefresher and its listAlivePeers call. Reproduce with the stated Maven command and determine whether the refresher can call the mock during stubbing. The linked pull request #3385 is already open; check its status and whether it resolves the intermittent failure.

索引モデルが issue の本文から書いたものです。

説明

Bug Type (问题类型)

others (please edit later)

Before submit
  • I have confirmed and searched that there are no similar problems in the historical issue and documents
Environment (环境信息)
  • Server Version: PD tests, hg-pd-test pd-core-test profile (PDCoreSuiteTest). Seen on the branch of #3376 at 171760d25, which does not change RaftEngineReadIndexTest or the alive-peers refresher of RaftEngine; both are as on master 86c05ef9c (the test from #3368, the refresher from #3185)
  • Backend: none (unit suite)
  • OS: Linux, 8 cores, JDK 17
  • Data Size: N/A
Expected & Actual behavior (期望与实际表现)

RaftEngineReadIndexTest.testStoppedReadServiceClosureThatRunsFirstFailsAsNotLeader should pass every run. It failed once in three runs of the same commit on 2026-10-20, with Mockito's unfinished-stubbing error while the test stubs readIndex:

[ERROR] org.apache.hugegraph.pd.raft.RaftEngineReadIndexTest.testStoppedReadServiceClosureThatRunsFirstFailsAsNotLeader -- Time elapsed: 0.012 s <<< ERROR!
org.mockito.exceptions.misusing.UnfinishedStubbingException:
Unfinished stubbing detected here:
-> at org.apache.hugegraph.pd.raft.RaftEngineReadIndexTest.answerShutdown(RaftEngineReadIndexTest.java:377)
	at org.apache.hugegraph.pd.raft.RaftEngineReadIndexTest.answerShutdown(RaftEngineReadIndexTest.java:382)
	at org.apache.hugegraph.pd.raft.RaftEngineReadIndexTest.testStoppedReadServiceClosureThatRunsFirstFailsAsNotLeader(RaftEngineReadIndexTest.java:367)

The runs, all mvn -B -ntp test -pl hugegraph-pd/hg-pd-test -am -P pd-core-test on 171760d25:

Host pd-core (run/failures/errors/skipped)
8 cores, JDK 17 227/0/1/2 (this error)
same host, again 227/0/0/2
12 cores, JDK 17 227/0/0/2

Likely cause, not proven: the test swaps a Mockito mock into the RaftEngine singleton (Whitebox.setInternalState(..., "raftNode", mockNode)) and stubs it, while the engine's pd-raft-alive-peers refresher thread (startAlivePeersRefresher, every ALIVE_PEERS_REFRESH_MS) calls node.listAlivePeers() on whatever node the singleton holds whenever its state machine reports leader. An earlier suite test can leave the singleton started and leading. A call on the mock from that thread while doAnswer(...).when(mockNode).readIndex(...) is in progress is the case Mockito reports as unfinished stubbing.

A fix could stop the refresher for these tests (or give the refresher a node snapshot taken under the same lock the tests use), or stub listAlivePeers on the mock before it is installed.

Vertex/Edge example (问题点 / 边数据举例)

N/A

Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)

N/A

主要言語
Java
スター
3.2k
フォーク
640
平均マージ
1日 11時間
マージ済み PR(30日)
90

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

apache/hugegraph のほかの issue

apache/hugegraph の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。