mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-06 17:18:35 +08:00
issue: #45831 This PR fixes a race condition in `TestZillizClient` test cases where `t.Logf` could be called after the test function had returned, leading to a panic or data race failure. Root cause: 1. Incorrect defer order: `defer s.Stop()` was called after `defer lis.Close()`. This caused `lis.Accept()` to return an error before `s.Stop()` had set the quit flag, triggering the error handling path in the server goroutine. 2. Unsafe logging: The error handling path used `t.Logf` inside a goroutine, which is unsafe if the main test function exits before the log is printed. Fixes: - Changed defer order to ensure `s.Stop()` is called before `lis.Close()`. - Replaced `t.Logf` with `fmt.Printf` in the background goroutine to avoid panic on test completion. Signed-off-by: Li Liu <li.liu@zilliz.com>