Test tcp deadlock fixes (#14946)
Some checks failed
CI / test-ubuntu-latest (push) Has been cancelled
CI / test-sanitizer-address (push) Has been cancelled
CI / build-debian-old (push) Has been cancelled
CI / build-macos-latest (push) Has been cancelled
CI / build-32bit (push) Has been cancelled
CI / build-libc-malloc (push) Has been cancelled
CI / build-centos-jemalloc (push) Has been cancelled
CI / build-old-chain-jemalloc (push) Has been cancelled
Codecov / code-coverage (push) Has been cancelled
External Server Tests / test-external-standalone (push) Has been cancelled
External Server Tests / test-external-cluster (push) Has been cancelled
External Server Tests / test-external-nodebug (push) Has been cancelled
Spellcheck / Spellcheck (push) Has been cancelled

This fix follows #14667 and #14886

Several tests pipelined large numbers of commands on deferring clients
without draining replies. That can fill buffers and stall progress.

Fix by draining replies every 500 pipelined requests to avoid TCP
stalls.

---------

Co-authored-by: oranagra <oran@redislabs.com>
This commit is contained in:
debing.sun 2026-03-30 19:50:47 +08:00
parent be8f1ad8b2
commit 557e027022
4 changed files with 45 additions and 7 deletions

View file

@ -54,9 +54,12 @@ test "Main db not affected when fail to diskless load" {
set rd [redis_deferring_client redis $master_id]
for {set j 0} {$j < $num} {incr j} {
$rd set $j $value
}
for {set j 0} {$j < $num} {incr j} {
$rd read
if {($j + 1) % 500 == 0} {
for {set i 0} {$i < 500} {incr i} {
$rd read
}
}
}
# Start the replica again

View file

@ -22,13 +22,18 @@ proc gen_write_load {host port seconds tls {key ""} {size 0} {sleep 0}} {
set start_time [clock seconds]
set r [redis $host $port 1 $tls]
$r client setname LOAD_HANDLER
$r select 9
$r read
catch {
$r select 9
$r read
} ;# select 9 will fail in cluster mode
# fixed size value
if {$size != 0} {
set value [string repeat "x" $size]
}
set count 0
while 1 {
if {$size == 0} {
set value [expr rand()]
@ -39,13 +44,28 @@ proc gen_write_load {host port seconds tls {key ""} {size 0} {sleep 0}} {
} else {
$r set $key $value
}
incr count
if {$count % 500 == 0} {
for {set i 0} {$i < 500} {incr i} {
$r read
}
set count 0
}
if {[clock seconds]-$start_time > $seconds} {
exit 0
break
}
if {$sleep ne 0} {
after $sleep
}
}
# Read remaining replies
for {set i 0} {$i < $count} {incr i} {
$r read
}
exit 0
}
gen_write_load [lindex $argv 0] [lindex $argv 1] [lindex $argv 2] [lindex $argv 3] [lindex $argv 4] [lindex $argv 5] [lindex $argv 6]

View file

@ -345,7 +345,7 @@ run_solo {defrag} {
# create big keys with 10k items
# Use batching to avoid TCP deadlock
set rd [redis_deferring_client]
set batch_size 1000
set batch_size 100
for {set j 0} {$j < 10000} {incr j} {
$rd hset bighash $j [concat "asdfasdfasdf" $j]
$rd lpush biglist [concat "asdfasdfasdf" $j]

View file

@ -1026,7 +1026,22 @@ foreach type {single multiple single_multiple} {
break
}
}
r srem $myset {*}$members
r deferred 1
set count 0
foreach m $members {
r srem $myset $m
incr count
if {$count == 500} {
for {set i 0} {$i < 500} {incr i} {
r read
}
set count 0
}
}
for {set i 0} {$i < $count} {incr i} {
r read
}
r deferred 0
}
proc verify_rehashing_completed_key {myset table_size keys} {