This is an automated email from the ASF dual-hosted git repository.
Alanxtl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git
The following commit(s) were added to refs/heads/develop by this push:
new 0c194ebfb fix(tool): drain in-flight requests before canceling ctx in
engine.Stop() (#3677)
0c194ebfb is described below
commit 0c194ebfb228792bfbd1af4058ef5515ee2e2b46
Author: Li Zining <[email protected]>
AuthorDate: Tue Aug 18 17:21:41 2026 +0800
fix(tool): drain in-flight requests before canceling ctx in engine.Stop()
(#3677)
The engine.Stop() method cancels the parent context before draining
in-flight requests, causing up to concurrency-many requests to be
recorded as context canceled failures on every benchmark teardown.
In low-QPS scenarios (1MiB payload), the failure rate reaches 0.86%,
making the success-rate metric inaccurate.
Swap e.cancel() and e.wg.Wait() so that in-flight requests complete
naturally before the context is canceled, eliminating the spurious
failures.
Fixes #3675
Signed-off-by: lizining <[email protected]>
---
tools/benchmark/client/engine/engine.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/benchmark/client/engine/engine.go
b/tools/benchmark/client/engine/engine.go
index c99332803..a386ce3bc 100644
--- a/tools/benchmark/client/engine/engine.go
+++ b/tools/benchmark/client/engine/engine.go
@@ -114,8 +114,8 @@ func (e *Engine) worker(benchmarkFunc BenchmarkFunc) {
func (e *Engine) Stop() {
e.stopOnce.Do(func() {
close(e.stopChan)
- e.cancel()
e.wg.Wait()
+ e.cancel()
logger.Info("[INFO] Benchmark completed")
})
}