[BUG] Thread.sleep(100) gating verify(times(2)) on async executor
- Dominant language
- Java
- Stars
- 8.8k
- Forks
- 3.1k
- Avg merge
- 7d 1h
- Merged PRs (30d)
- 85
Description
## Description
Sleep 100ms then `Mockito.verify(RegisterUtils.doHeartBeat..., times(2))` and `assertTrue(executor.isShutdown())`. Under load the executor may not finish in 100ms -> false failure (and #6351-style `ConcurrentModificationException` risk lives in this same area).
## Location
```
shenyu-register-center/shenyu-register-client-beat/src/test/java/org/apache/shenyu/register/client/beat/HeartbeatListenerTest.java:161,215
```
## Impact
Flaky verify/isShutdown assertions.
## Suggested fix
Use `Awaitility.await().untilAsserted(() -> verify(..., times(2)))` and a deterministic shutdown latch.
## Related existing issue(s)
Adjacent to #6351 but a different test/method.
_Identified during the 2026-08-02 audit; full list in [`docs/issue-candidates-2026-08-02.md`](docs/issue-candidates-2026-08-02.md)._
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in shenyu-register-center/shenyu-register-client-beat/src/test/java/org/apache/shenyu/register/client/beat/HeartbeatListenerTest.java at lines 161 and 215. Review how the async executor, Thread.sleep(100), verify(times(2)), and isShutdown assertions interact, then run this test under load. Done means the assertions wait deterministically without flaky failures or the identified shutdown race.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100