lizining1231 opened a new pull request, #3677: URL: https://github.com/apache/dubbo-go/pull/3677
### Description Fixes #3675 `engine.Stop()` cancels the parent context before draining in-flight requests, causing up to `concurrency` 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. The `benchmarkFunc(ctx)` already has a `requestTimeout` safety bound ### Changes - `tools/benchmark/client/engine/engine.go` — swap `e.cancel()` and `e.wg.Wait()` in `Stop()` ### Test | Test | Description | | --- | --- | | 1MiB payload, 50 concurrency, 10s benchmark (before fix) | Failure <=50, logs flooded with `lastErr=canceled: context canceled` | | 1MiB payload, 50 concurrency, 10s benchmark (after fix) | Failure = 0, Success Rate = 100% | Validation was performed via manual benchmark reproduction. ### Validation - Before fix: `Stop()` kills in-flight requests as `context canceled`, low-QPS scenarios show 99.27% success rate - After fix: in-flight requests complete naturally, success rate 100.00%, no spurious errors - `go build ./tools/benchmark/client/...` passes - `go test ./tools/benchmark/...` passes ### Checklist - [x] I confirm the target branch is `develop` - [x] I have run `make fmt` to format my code - [x] I have run `make test` to run local tests - [ ] I have added tests that prove my fix is effective or that my feature works -- 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]
