Zjianru opened a new pull request, #7994: URL: https://github.com/apache/incubator-seata/pull/7994
### Ⅰ. Issue Description Fixes #7963. **English:** The test `ClusterControllerTest#watch_withHttp2` fails intermittently with `AssertionFailedError: expected: <true> but was: <false>`. This is caused by the async callback failure not being propagated to the main test thread properly, leading to a timeout in `latch.await()`. **中文:** 测试 `ClusterControllerTest#watch_withHttp2` 偶发失败,报错 `AssertionFailedError: expected: <true> but was: <false>`。 原因是异步回调中的异常未正确传播到主测试线程,导致 `latch.await()` 超时。 ### Ⅱ. Describe what happened **English:** The original test code uses `Assertions.fail()` inside the async callback `onFailure` and `onCancelled`. Exceptions thrown in async callbacks are not caught by the JUnit main thread, causing `latch.countDown()` to be skipped. The main thread then waits until timeout (35s) and fails with a generic assertion error, masking the real cause. **中文:** 原测试代码在异步回调 `onFailure` 和 `onCancelled` 中使用了 `Assertions.fail()`。 异步回调中抛出的异常无法被 JUnit 主线程捕获,导致 `latch.countDown()` 被跳过。 主线程随后等待直到超时(35秒),并因通用的断言错误而失败,掩盖了真正的原因。 ### Ⅲ. Describe what you expected to happen **English:** The test should fail immediately if an error occurs in the async callback, and report the actual exception. **中文:** 如果异步回调中发生错误,测试应立即失败,并报告实际的异常信息。 ### Ⅳ. How to reproduce it (as minimally and precisely as possible) Run `ClusterControllerTest#watch_withHttp2`. ### Ⅴ. Anything else we need to know? **English:** This PR introduces `AtomicReference<Throwable>` to capture async exceptions and ensures `latch.countDown()` is called in all callback methods. **中文:** 本 PR 引入了 `AtomicReference<Throwable>` 来捕获异步异常,并确保在所有回调方法中都调用 `latch.countDown()`。 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
