[Bug] RaftEngineReadIndexTest fails now and then with UnfinishedStubbingException: the alive-peers refresher can call the mocked raft node while a test stubs it
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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-testpd-core-testprofile (PDCoreSuiteTest). Seen on the branch of #3376 at171760d25, which does not changeRaftEngineReadIndexTestor the alive-peers refresher ofRaftEngine; both are as onmaster86c05ef9c(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
- Ngôn ngữ chính
- Java
- Star
- 3.2k
- Fork
- 640
- Merge trung bình
- 1 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 90
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/hugegraph
-
[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 answerCó thể đã có người làm @pallavithegod đã nhận 5 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
apache/hugegraph#3231 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] PD raft port accepts jraft CLI membership requests, which bypass the checks of changePeerList and updatePdRaftCó thể đã có người làm @Mihir-Rabari đã nhận hôm nay. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] PD TTL cleanup deletes the marker-shaped name instead of the expired key, so expired values stay in the store until readCó thể đã có người làm @bitflicker64 đã nhận 1 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Task] Establish systematic performance baselines and optimization trackingCó thể đã có người làm @contrueCT đã nhận 5 ngày trước. Đang mởhelp wanted improvement rust
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 12/100
apache/hugegraph#3346 · 2 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của apache/hugegraph
Issue tương tự
-
ChaosEngine: backup-remote doctor row passes while consumer mode hides bot memory from gitCó thể đã có người làm @MohabMohie đã nhận hôm nay. Đang mởagentic
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
ShaftHQ/SHAFT_ENGINE#7263 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
bug/错误
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
FCL-Team/FoldCraftLauncher#1951 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
quarkusio/quarkus-agent-mcp#296 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
commons-app/apps-android-commons#7072 ·
Maintainer thường phản hồi trong vòng 1 ngày