Fix inaccurate IO thread client count due to delayed freeing (#14723)
Some checks are pending
CI / test-ubuntu-latest (push) Waiting to run
CI / test-sanitizer-address (push) Waiting to run
CI / build-debian-old (push) Waiting to run
CI / build-macos-latest (push) Waiting to run
CI / build-32bit (push) Waiting to run
CI / build-libc-malloc (push) Waiting to run
CI / build-centos-jemalloc (push) Waiting to run
CI / build-old-chain-jemalloc (push) Waiting to run
Codecov / code-coverage (push) Waiting to run
External Server Tests / test-external-standalone (push) Waiting to run
External Server Tests / test-external-cluster (push) Waiting to run
External Server Tests / test-external-nodebug (push) Waiting to run
Spellcheck / Spellcheck (push) Waiting to run

There is a failure in CI:
```
*** [err]: Clients are evenly distributed among io threads in tests/unit/introspection.tcl
Expected '2' to be equal to '1' (context: type eval line 3 cmd {assert_equal $cur_clients 1} proc ::start_server)
```

There might be a client used for health checks (to detect if the server
is up)
that has not been freed timely. This can lead to an inaccurate count of
connected clients processed by IO threads. So we wait it to close
completely.
This commit is contained in:
Yuan Wang 2026-01-21 18:13:40 +08:00 committed by GitHub
parent 25f780b662
commit a2e901c93d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1066,8 +1066,14 @@ test {IO threads client number} {
test {Clients are evenly distributed among io threads} {
start_server {overrides {io-threads 4} tags {external:skip}} {
set cur_clients [s connected_clients]
assert_equal $cur_clients 1
# There might be a client used for health checks (to detect if the server is up)
# that has not been freed timely. This can lead to an inaccurate count of
# connectedclients processed by IO threads.
wait_for_condition 1000 10 {
[s connected_clients] eq 1
} else {
fail "Fail to wait for connected_clients to be 1"
}
global rdclients
for {set i 1} {$i < 9} {incr i} {
set rdclients($i) [redis_deferring_client]