Describe the bug This test may fail on external server. It succeeds normaly, but fails occasionally on my environment with some arbitrary network deny.
test "BLMPOP with multiple blocked clients" {
set rd1 [redis_deferring_client]
set rd2 [redis_deferring_client]
set rd3 [redis_deferring_client]
set rd4 [redis_deferring_client]
r del blist{t} blist2{t}
$rd1 blmpop 0 2 blist{t} blist2{t} left count 1
$rd2 blmpop 0 2 blist{t} blist2{t} right count 10
$rd3 blmpop 0 2 blist{t} blist2{t} left count 10
$rd4 blmpop 0 2 blist{t} blist2{t} right count 1
wait_for_blocked_clients_count 4
r multi
r lpush blist{t} a b c d e
r lpush blist2{t} 1 2 3 4 5
r exec
assert_equal {blist{t} e} [$rd1 read]
assert_equal {blist{t} {a b c d}} [$rd2 read]
assert_equal {blist2{t} {5 4 3 2 1}} [$rd3 read]
r lpush blist2{t} 1 2 3
assert_equal {blist2{t} 1} [$rd4 read]
$rd1 close
$rd2 close
$rd3 close
$rd4 close
}
To reproduce
I guess it may depend on the order of sending the four blmpop commands.
Just changing the sending order like this to simulate the disordered arrival due to network deny, it almost always fails.
$rd4 blmpop 0 2 blist{t} blist2{t} right count 1
$rd1 blmpop 0 2 blist{t} blist2{t} left count 1
$rd2 blmpop 0 2 blist{t} blist2{t} right count 10
$rd3 blmpop 0 2 blist{t} blist2{t} left count 10
Expected behavior
This test may not depend on the sending order or be removed out of external server tests because the unreliable network condition.
Additional information
Comment From: aakejiang
+1 The test is based on the wrong assumption that commands sent first would be arrived first in Redis server, which is not always true for the network delay.
Comment From: enjoy-binbin
ohh sorry... I actually wrote this... i see the problem now, i will take a look later