Skip to content

Conversation

@sundb
Copy link
Collaborator

@sundb sundb commented Jul 3, 2025

This PR is based on valkey-io/valkey#2117

When a client is blocked by something like CLIENT PAUSE, we should not allow CLIENT UNBLOCK timeout to unblock it, since some blocking types does not has the timeout callback, it will trigger a panic in the core, people should use CLIENT UNPAUSE to unblock it.

Also using CLIENT UNBLOCK error is not right, it will return a UNBLOCKED error to the command, people don't expect a SET command to get an error.

So in this commit, in these cases, we will return 0 to CLIENT UNBLOCK to indicate the unblock is fail. The reason is that we assume that if a command doesn't expect to be timedout, it also doesn't expect to be unblocked by CLIENT UNBLOCK.

The old behavior of the following command will trigger panic in timeout and get UNBLOCKED error in error. Under the new behavior, client unblock will get the result of 0.

client 1> client pause 100000 write
client 2> set x x

client 1> client unblock 2 timeout
or
client 1> client unblock 2 error

Potentially breaking change, previously allowed CLIENT UNBLOCK error.

Signed-off-by: Binbin binloveplay1314@qq.com
Co-authored-by: Binbin binloveplay1314@qq.com

When a client is blocked by something like `CLIENT PAUSE`, we should not
allow `CLIENT UNBLOCK timeout` to unblock it, since some blocking types
does not has the timeout callback, it will trigger a panic in the core,
people should use `CLIENT UNPAUSE` to unblock it.

Also using `CLIENT UNBLOCK error` is not right, it will return a UNBLOCKED
error to the command, people don't expect a `SET` command to get an error.

So in this commit, in these cases, we will return 0 to `CLIENT UNBLOCK`
to indicate the unblock is fail. The reason is that we assume that if
a command doesn't expect to be timedout, it also doesn't expect to be
unblocked by `CLIENT UNBLOCK`.

The old behavior of the following command will trigger panic in timeout
and get UNBLOCKED error in error. Under the new behavior, client unblock
will get the result of 0.
```
client 1> client pause 100000 write
client 2> set x x

client 1> client unblock 2 timeout
or
client 1> client unblock 2 error
```

Potentially breaking change, previously allowed `CLIENT UNBLOCK error`.

Signed-off-by: Binbin <binloveplay1314@qq.com>
Co-authored-by: Binbin <binloveplay1314@qq.com>
@snyk-io
Copy link

snyk-io bot commented Jul 3, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

@sundb
Copy link
Collaborator Author

sundb commented Jul 3, 2025

crash report

Logged crash report (pid 22719):
=== REDIS BUG REPORT START: Cut & paste starting from here ===
22719:M 03 Jul 2025 10:06:24.349 # ------------------------------------------------
22719:M 03 Jul 2025 10:06:24.349 # !!! Software Failure. Press left mouse button to continue
22719:M 03 Jul 2025 10:06:24.349 # Guru Meditation: Unknown btype in replyToBlockedClientTimedOut(). #blocked.c:237

------ STACK TRACE ------

22723 bio_lazy_free
/lib/x86_64-linux-gnu/libc.so.6(+0x98d71)[0x7f16de298d71]
/lib/x86_64-linux-gnu/libc.so.6(pthread_cond_wait+0x20d)[0x7f16de29b7ed]
src/redis-server 127.0.0.1:21611(bioProcessBackgroundJobs+0x1ea)[0x556402beabea]
/lib/x86_64-linux-gnu/libc.so.6(+0x9caa4)[0x7f16de29caa4]
/lib/x86_64-linux-gnu/libc.so.6(+0x129c3c)[0x7f16de329c3c]

22721 bio_close_file
/lib/x86_64-linux-gnu/libc.so.6(+0x98d71)[0x7f16de298d71]
/lib/x86_64-linux-gnu/libc.so.6(pthread_cond_wait+0x20d)[0x7f16de29b7ed]
src/redis-server 127.0.0.1:21611(bioProcessBackgroundJobs+0x1ea)[0x556402beabea]
/lib/x86_64-linux-gnu/libc.so.6(+0x9caa4)[0x7f16de29caa4]
/lib/x86_64-linux-gnu/libc.so.6(+0x129c3c)[0x7f16de329c3c]

22719 redis-server *
src/redis-server 127.0.0.1:21611(+0x1b5009)[0x556402c07009]
src/redis-server 127.0.0.1:21611(clientCommand+0x1a57)[0x556402b318b7]
src/redis-server 127.0.0.1:21611(call+0x74c)[0x556402b0425c]
src/redis-server 127.0.0.1:21611(processCommand+0xb3d)[0x556402b1167d]
src/redis-server 127.0.0.1:21611(processInputBuffer+0xd9)[0x556402b2a679]
src/redis-server 127.0.0.1:21611(readQueryFromClient+0x358)[0x556402b2f558]
src/redis-server 127.0.0.1:21611(+0x223564)[0x556402c75564]
src/redis-server 127.0.0.1:21611(aeMain+0xf9)[0x556402ae5989]
src/redis-server 127.0.0.1:21611(main+0x4a7)[0x556402adf857]
/lib/x86_64-linux-gnu/libc.so.6(+0x2a1ca)[0x7f16de22a1ca]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x8b)[0x7f16de22a28b]
src/redis-server 127.0.0.1:21611(_start+0x25)[0x556402ae10d5]

22722 bio_aof
/lib/x86_64-linux-gnu/libc.so.6(+0x98d71)[0x7f16de298d71]
/lib/x86_64-linux-gnu/libc.so.6(pthread_cond_wait+0x20d)[0x7f16de29b7ed]
src/redis-server 127.0.0.1:21611(bioProcessBackgroundJobs+0x1ea)[0x556402beabea]
/lib/x86_64-linux-gnu/libc.so.6(+0x9caa4)[0x7f16de29caa4]
/lib/x86_64-linux-gnu/libc.so.6(+0x129c3c)[0x7f16de329c3c]

4/4 expected stacktraces.

------ STACK TRACE DONE ------

------ INFO OUTPUT ------
# Server
redis_version:255.255.255
redis_git_sha1:ad8c7de3
redis_git_dirty:0
redis_build_id:ae7c5af33b31e2e4
redis_mode:standalone
os:Linux 6.8.0-62-generic x86_64
arch_bits:64
monotonic_clock:POSIX clock_gettime
multiplexing_api:epoll
atomicvar_api:c11-builtin
gcc_version:13.3.0
process_id:22719
process_supervised:no
run_id:839e636e5578c754ec05e89b8f918b0ef08a213e
tcp_port:21611
server_time_usec:1751508384349797
uptime_in_seconds:1
uptime_in_days:0
hz:10
configured_hz:10
lru_clock:6677920
executable:/home/sundb/data/redis_fork_5/src/redis-server
config_file:/home/sundb/data/redis_fork_5/./tests/tmp/redis.conf.22700.2
io_threads_active:0
listener0:name=tcp,bind=127.0.0.1,port=21611
listener1:name=unix,bind=/home/sundb/data/redis_fork_5/tests/tmp/server.22700.1/socket

# Clients
connected_clients:4
cluster_connections:0
maxclients:10000
client_recent_max_input_buffer:56
client_recent_max_output_buffer:20504
blocked_clients:2
tracking_clients:0
pubsub_clients:0
watching_clients:0
clients_in_timeout_table:0
total_watched_keys:0
total_blocking_keys:0
total_blocking_keys_on_nokey:0

# Memory
used_memory:1379848
used_memory_human:1.32M
used_memory_rss:9961472
used_memory_rss_human:9.50M
used_memory_peak:1379848
used_memory_peak_human:1.32M
used_memory_peak_time:1751508384
used_memory_peak_perc:100.02%
used_memory_overhead:766124
used_memory_startup:651120
used_memory_dataset:613724
used_memory_dataset_perc:84.22%
allocator_allocated:2404128
allocator_active:2629632
allocator_resident:10067968
allocator_muzzy:0
total_system_memory:66516324352
total_system_memory_human:61.95G
used_memory_lua:43008
used_memory_vm_eval:43008
used_memory_lua_human:42.00K
used_memory_scripts_eval:2072
number_of_cached_scripts:11
number_of_functions:1
number_of_libraries:1
used_memory_vm_functions:34816
used_memory_vm_total:77824
used_memory_vm_total_human:76.00K
used_memory_functions:568
used_memory_scripts:2640
used_memory_scripts_human:2.58K
maxmemory:0
maxmemory_human:0B
maxmemory_policy:noeviction
allocator_frag_ratio:1.06
allocator_frag_bytes:116832
allocator_rss_ratio:3.83
allocator_rss_bytes:7438336
rss_overhead_ratio:0.99
rss_overhead_bytes:-106496
mem_fragmentation_ratio:7.92
mem_fragmentation_bytes:8703992
mem_not_counted_for_evict:0
mem_replication_backlog:20508
mem_total_replication_buffers:20504
mem_replica_full_sync_buffer:0
mem_clients_slaves:0
mem_clients_normal:11008
mem_cluster_links:0
mem_aof_buffer:0
mem_allocator:jemalloc-5.3.0
mem_overhead_db_hashtable_rehashing:0
active_defrag_running:0
lazyfree_pending_objects:0
lazyfreed_objects:8

# Persistence
loading:0
async_loading:0
current_cow_peak:0
current_cow_size:0
current_cow_size_age:0
current_fork_perc:0.00
current_save_keys_processed:0
current_save_keys_total:0
rdb_changes_since_last_save:30
rdb_bgsave_in_progress:0
rdb_last_save_time:1751508383
rdb_last_bgsave_status:ok
rdb_last_bgsave_time_sec:0
rdb_current_bgsave_time_sec:-1
rdb_saves:0
rdb_last_cow_size:839680
rdb_last_load_keys_expired:0
rdb_last_load_keys_loaded:0
aof_enabled:0
aof_rewrite_in_progress:0
aof_rewrite_scheduled:0
aof_last_rewrite_time_sec:-1
aof_current_rewrite_time_sec:-1
aof_last_bgrewrite_status:ok
aof_rewrites:0
aof_rewrites_consecutive_failures:0
aof_last_write_status:ok
aof_last_cow_size:0
module_fork_in_progress:0
module_fork_last_cow_size:0

# Threads
io_thread_0:clients=4,reads=181,writes=157

# Stats
total_connections_received:24
total_commands_processed:159
instantaneous_ops_per_sec:89
total_net_input_bytes:5614
total_net_output_bytes:129872
total_net_repl_input_bytes:0
total_net_repl_output_bytes:87
instantaneous_input_kbps:3.09
instantaneous_output_kbps:74.86
instantaneous_input_repl_kbps:0.00
instantaneous_output_repl_kbps:0.05
rejected_connections:0
sync_full:1
sync_partial_ok:0
sync_partial_err:1
expired_subkeys:0
expired_keys:3
expired_stale_perc:0.00
expired_time_cap_reached_count:0
expire_cycle_cpu_milliseconds:0
evicted_keys:0
evicted_clients:0
evicted_scripts:0
total_eviction_exceeded_time:0
current_eviction_exceeded_time:0
keyspace_hits:7
keyspace_misses:6
pubsub_channels:0
pubsub_patterns:0
pubsubshard_channels:0
latest_fork_usec:188
total_forks:1
migrate_cached_sockets:0
slave_expires_tracked_keys:0
active_defrag_hits:0
active_defrag_misses:0
active_defrag_key_hits:0
active_defrag_key_misses:0
total_active_defrag_time:0
current_active_defrag_time:0
tracking_total_keys:0
tracking_total_items:0
tracking_total_prefixes:0
unexpected_error_replies:0
total_error_replies:3
dump_payload_sanitizations:0
total_reads_processed:181
total_writes_processed:157
io_threaded_reads_processed:0
io_threaded_writes_processed:0
io_threaded_total_prefetch_batches:0
io_threaded_total_prefetch_entries:0
client_query_buffer_limit_disconnections:0
client_output_buffer_limit_disconnections:0
reply_buffer_shrinks:3
reply_buffer_expands:3
eventloop_cycles:215
eventloop_duration_sum:5544
eventloop_duration_cmd_sum:1170
instantaneous_eventloop_cycles_per_sec:119
instantaneous_eventloop_duration_usec:37
acl_access_denied_auth:0
acl_access_denied_cmd:0
acl_access_denied_key:0
acl_access_denied_channel:0

# Replication
role:master
connected_slaves:0
master_failover_state:no-failover
master_replid:c3233474ceec9a75bf9a4398ce6d1558e15c67cf
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:190
second_repl_offset:-1
repl_backlog_active:1
repl_backlog_size:1048576
repl_backlog_first_byte_offset:1
repl_backlog_histlen:190

# CPU
used_cpu_sys:0.009262
used_cpu_user:0.002805
used_cpu_sys_children:0.001295
used_cpu_user_children:0.000000
used_cpu_sys_main_thread:0.008414
used_cpu_user_main_thread:0.003148

# Modules
module:name=vectorset,ver=1,api=1,filters=0,usedby=[],using=[],options=[handle-io-errors|handle-repl-async-load]

# Commandstats
cmdstat_psync:calls=2,usec=255,usec_per_call=127.50,rejected_calls=0,failed_calls=0
cmdstat_multi:calls=8,usec=2,usec_per_call=0.25,rejected_calls=0,failed_calls=0
cmdstat_flushall:calls=1,usec=248,usec_per_call=248.00,rejected_calls=0,failed_calls=0
cmdstat_config|set:calls=1,usec=3,usec_per_call=3.00,rejected_calls=0,failed_calls=0
cmdstat_randomkey:calls=2,usec=10,usec_per_call=5.00,rejected_calls=0,failed_calls=0
cmdstat_evalsha:calls=1,usec=0,usec_per_call=0.00,rejected_calls=0,failed_calls=0
cmdstat_client|unpause:calls=15,usec=6,usec_per_call=0.40,rejected_calls=0,failed_calls=0
cmdstat_client|id:calls=2,usec=1,usec_per_call=0.50,rejected_calls=0,failed_calls=0
cmdstat_client|pause:calls=19,usec=17,usec_per_call=0.89,rejected_calls=0,failed_calls=0
cmdstat_replconf:calls=4,usec=8,usec_per_call=2.00,rejected_calls=0,failed_calls=0
cmdstat_exec:calls=8,usec=51,usec_per_call=6.38,rejected_calls=0,failed_calls=0
cmdstat_ping:calls=4,usec=4,usec_per_call=1.00,rejected_calls=0,failed_calls=0
cmdstat_pfadd:calls=1,usec=3,usec_per_call=3.00,rejected_calls=0,failed_calls=0
cmdstat_publish:calls=2,usec=0,usec_per_call=0.00,rejected_calls=2,failed_calls=0
cmdstat_set:calls=18,usec=55,usec_per_call=3.06,rejected_calls=1,failed_calls=0
cmdstat_get:calls=12,usec=20,usec_per_call=1.67,rejected_calls=0,failed_calls=0
cmdstat_script|load:calls=1,usec=4,usec_per_call=4.00,rejected_calls=0,failed_calls=0
cmdstat_fcall:calls=1,usec=1,usec_per_call=1.00,rejected_calls=0,failed_calls=0
cmdstat_pfcount:calls=1,usec=1,usec_per_call=1.00,rejected_calls=0,failed_calls=0
cmdstat_function|load:calls=1,usec=23,usec_per_call=23.00,rejected_calls=0,failed_calls=0
cmdstat_eval:calls=10,usec=56,usec_per_call=5.60,rejected_calls=0,failed_calls=1
cmdstat_info:calls=21,usec=616,usec_per_call=29.33,rejected_calls=0,failed_calls=0
cmdstat_del:calls=1,usec=1,usec_per_call=1.00,rejected_calls=0,failed_calls=0
cmdstat_select:calls=21,usec=9,usec_per_call=0.43,rejected_calls=0,failed_calls=0
cmdstat_eval_ro:calls=2,usec=37,usec_per_call=18.50,rejected_calls=0,failed_calls=1

# Errorstats
errorstat_ERR:count=3

# Latencystats
latency_percentiles_usec_psync:p50=30.079,p99=225.279,p99.9=225.279
latency_percentiles_usec_multi:p50=0.001,p99=1.003,p99.9=1.003
latency_percentiles_usec_flushall:p50=248.831,p99=248.831,p99.9=248.831
latency_percentiles_usec_config|set:p50=3.007,p99=3.007,p99.9=3.007
latency_percentiles_usec_randomkey:p50=3.007,p99=7.007,p99.9=7.007
latency_percentiles_usec_evalsha:p50=0.001,p99=0.001,p99.9=0.001
latency_percentiles_usec_client|unpause:p50=0.001,p99=2.007,p99.9=2.007
latency_percentiles_usec_client|id:p50=0.001,p99=1.003,p99.9=1.003
latency_percentiles_usec_client|pause:p50=1.003,p99=5.023,p99.9=5.023
latency_percentiles_usec_replconf:p50=0.001,p99=7.007,p99.9=7.007
latency_percentiles_usec_exec:p50=5.023,p99=14.015,p99.9=14.015
latency_percentiles_usec_ping:p50=0.001,p99=3.007,p99.9=3.007
latency_percentiles_usec_pfadd:p50=3.007,p99=3.007,p99.9=3.007
latency_percentiles_usec_publish:p50=0.001,p99=0.001,p99.9=0.001
latency_percentiles_usec_set:p50=1.003,p99=11.007,p99.9=11.007
latency_percentiles_usec_get:p50=1.003,p99=5.023,p99.9=5.023
latency_percentiles_usec_script|load:p50=4.015,p99=4.015,p99.9=4.015
latency_percentiles_usec_fcall:p50=1.003,p99=1.003,p99.9=1.003
latency_percentiles_usec_pfcount:p50=1.003,p99=1.003,p99.9=1.003
latency_percentiles_usec_function|load:p50=23.039,p99=23.039,p99.9=23.039
latency_percentiles_usec_eval:p50=4.015,p99=16.063,p99.9=16.063
latency_percentiles_usec_info:p50=18.047,p99=92.159,p99.9=92.159
latency_percentiles_usec_del:p50=1.003,p99=1.003,p99.9=1.003
latency_percentiles_usec_select:p50=0.001,p99=2.007,p99.9=2.007
latency_percentiles_usec_eval_ro:p50=12.031,p99=25.087,p99.9=25.087

# Cluster
cluster_enabled:0

# Keyspace

# Keysizes

------ CLIENT LIST OUTPUT ------
id=5 addr=127.0.0.1:46155 laddr=127.0.0.1:21611 fd=12 name= age=1 idle=0 flags=N db=9 sub=0 psub=0 ssub=0 multi=-1 watch=0 qbuf=50 qbuf-free=20424 argv-mem=22 multi-mem=0 rbs=8192 rbp=6085 obl=0 oll=0 omem=0 tot-mem=29622 events=r cmd=client|unblock user=default redir=-1 resp=2 lib-name= lib-ver= io-thread=0 tot-net-in=3098 tot-net-out=123300 tot-cmds=90
id=7 addr=127.0.0.1:34369 laddr=127.0.0.1:21611 fd=13 name= age=1 idle=1 flags=N db=9 sub=0 psub=0 ssub=0 multi=-1 watch=0 qbuf=0 qbuf-free=0 argv-mem=0 multi-mem=0 rbs=1024 rbp=9 obl=0 oll=0 omem=0 tot-mem=1920 events=r cmd=get user=default redir=-1 resp=2 lib-name= lib-ver= io-thread=0 tot-net-in=76 tot-net-out=19 tot-cmds=3
id=26 addr=127.0.0.1:42781 laddr=127.0.0.1:21611 fd=14 name= age=0 idle=0 flags=b db=9 sub=0 psub=0 ssub=0 multi=-1 watch=0 qbuf=0 qbuf-free=0 argv-mem=12 multi-mem=0 rbs=16384 rbp=16384 obl=0 oll=0 omem=0 tot-mem=17316 events=r cmd=blpop user=default redir=-1 resp=2 lib-name= lib-ver= io-thread=0 tot-net-in=81 tot-net-out=10 tot-cmds=2
id=27 addr=127.0.0.1:45741 laddr=127.0.0.1:21611 fd=15 name= age=0 idle=0 flags=b db=9 sub=0 psub=0 ssub=0 multi=-1 watch=0 qbuf=0 qbuf-free=0 argv-mem=12 multi-mem=0 rbs=16384 rbp=16384 obl=0 oll=0 omem=0 tot-mem=17316 events=r cmd=blpop user=default redir=-1 resp=2 lib-name= lib-ver= io-thread=0 tot-net-in=81 tot-net-out=10 tot-cmds=2

------ CURRENT CLIENT INFO ------
id=5 addr=127.0.0.1:46155 laddr=127.0.0.1:21611 fd=12 name= age=1 idle=0 flags=N db=9 sub=0 psub=0 ssub=0 multi=-1 watch=0 qbuf=50 qbuf-free=20424 argv-mem=22 multi-mem=0 rbs=8192 rbp=6085 obl=0 oll=0 omem=0 tot-mem=29622 events=r cmd=client|unblock user=default redir=-1 resp=2 lib-name= lib-ver= io-thread=0 tot-net-in=3098 tot-net-out=123300 tot-cmds=90
argc: '4'
argv[0]: '"client"'
argv[1]: '"unblock"'
argv[2]: '"26"'
argv[3]: '"timeout"'

------ EXECUTING CLIENT INFO ------
id=5 addr=127.0.0.1:46155 laddr=127.0.0.1:21611 fd=12 name= age=1 idle=0 flags=N db=9 sub=0 psub=0 ssub=0 multi=-1 watch=0 qbuf=50 qbuf-free=20424 argv-mem=22 multi-mem=0 rbs=8192 rbp=6085 obl=0 oll=0 omem=0 tot-mem=29622 events=r cmd=client|unblock user=default redir=-1 resp=2 lib-name= lib-ver= io-thread=0 tot-net-in=3098 tot-net-out=123300 tot-cmds=90
argc: '4'
argv[0]: '"client"'
argv[1]: '"unblock"'
argv[2]: '"26"'
argv[3]: '"timeout"'

------ MODULES INFO OUTPUT ------

------ CONFIG DEBUG OUTPUT ------
io-threads 1
lazyfree-lazy-user-del no
repl-diskless-load disabled
sanitize-dump-payload no
lazyfree-lazy-expire no
list-compress-depth 0
slave-read-only yes
repl-diskless-sync yes
lazyfree-lazy-eviction no
proto-max-bulk-len 512mb
lazyfree-lazy-server-del no
lazyfree-lazy-user-flush no
activedefrag no
replica-read-only yes
client-query-buffer-limit 1gb

------ FAST MEMORY TEST ------
22719:M 03 Jul 2025 10:06:24.352 # Bio worker thread #0 terminated
22719:M 03 Jul 2025 10:06:24.352 # Bio worker thread #1 terminated
22719:M 03 Jul 2025 10:06:24.352 # Bio worker thread #2 terminated
*** Preparing to test memory region 556402e64000 (2322432 bytes)
*** Preparing to test memory region 5564047b5000 (135168 bytes)
*** Preparing to test memory region 7f16d4000000 (135168 bytes)
*** Preparing to test memory region 7f16d9a00000 (4194304 bytes)
*** Preparing to test memory region 7f16d9f7b000 (2621440 bytes)
*** Preparing to test memory region 7f16da1fc000 (8388608 bytes)
*** Preparing to test memory region 7f16da9fd000 (8388608 bytes)
*** Preparing to test memory region 7f16db1fe000 (8388608 bytes)
*** Preparing to test memory region 7f16db9ff000 (8388608 bytes)
*** Preparing to test memory region 7f16dc200000 (8388608 bytes)
*** Preparing to test memory region 7f16dca00000 (10485760 bytes)
*** Preparing to test memory region 7f16dda00000 (8388608 bytes)
*** Preparing to test memory region 7f16de405000 (53248 bytes)
*** Preparing to test memory region 7f16de87a000 (16384 bytes)
*** Preparing to test memory region 7f16de99c000 (28672 bytes)
*** Preparing to test memory region 7f16dead0000 (8192 bytes)
.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O
Fast memory test PASSED, however your memory can still be broken. Please run a memory test for several hours if possible.

=== REDIS BUG REPORT END. Make sure to include from START to END. ===

       Please report the crash by opening an issue on github:

           http://github.com/redis/redis/issues

  If a Redis module was involved, please open in the module's repo instead.

  Suspect RAM error? Use redis-server --test-memory to verify it.

  Some other issues could be detected by redis-server --check-system

@github-project-automation github-project-automation bot moved this to Todo in Redis 8.2 Jul 3, 2025
@sundb sundb added release-notes indication that this issue needs to be mentioned in the release notes breaking-change This change can potentially break existing application and removed breaking-change This change can potentially break existing application labels Jul 3, 2025
@sundb
Copy link
Collaborator Author

sundb commented Jul 3, 2025

@oranagra Before this fix, client2 will get a response: (error) UNBLOCKED client unblocked via CLIENT UNBLOCK after client unblock 2 error, which was a bug. So I think it's not a break change.

client 1> client pause 100000 write
client 2> set x x

client 1> client unblock 2 error
client 2> (error) UNBLOCKED client unblocked via CLIENT UNBLOCK

@oranagra
Copy link
Member

oranagra commented Jul 3, 2025

i agree. i'd consider this a bug fix, not a breaking change.
as far as i can tell, the old behavior could only result in problems, not something that anyone may count on.

@kaplanben
Copy link

kaplanben commented Jul 21, 2025

Logo
Checkmarx One – Scan Summary & Detailsda23eb1c-c73f-49e2-892d-cb606f1c8edf

New Issues (1)

Checkmarx found the following issues in this Pull Request

Severity Issue Source File / Package Checkmarx Insight
MEDIUM Divide_By_Zero /modules/vector-sets/fastjson_test.c: 121
detailsThe application performs an illegal operation in generate_random_string, in /modules/vector-sets/fastjson_test.c. In line 121, the program at...
ID: qiowoZ%2FDUFf8wA3ZCvKY8M0GHks%3D
Attack Vector
Fixed Issues (1)

Great job! The following issues were fixed in this Pull Request

Severity Issue Source File / Package
LOW Use_of_Insufficiently_Random_Values /modules/vector-sets/hnsw.c: 1983

@sundb sundb merged commit ecd5e63 into redis:unstable Jul 24, 2025
19 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in Redis 8.2 Jul 24, 2025
@sundb sundb mentioned this pull request Aug 4, 2025
sundb added a commit that referenced this pull request Aug 4, 2025
This is the General Availability release of Redis Open Source 8.2.

### Major changes compared to 8.0

- Streams - new commands: `XDELEX` and `XACKDEL`; extension to `XADD`
and `XTRIM`
- Bitmap - `BITOP`: new operators: `DIFF`, `DIFF1`, `ANDOR`, and `ONE`
- Query Engine - new SVS-VAMANA vector index type which supports vector
compression
- More than 15 performance and resource utilization improvements
- New metrics: per-slot usage metrics, key size distributions for basic
data types, and more

### Binary distributions

- Alpine and Debian Docker images - https://hub.docker.com/_/redis
- Install using snap - see https://github.com/redis/redis-snap
- Install using brew - see https://github.com/redis/homebrew-redis
- Install using RPM - see https://github.com/redis/redis-rpm
- Install using Debian APT - see https://github.com/redis/redis-debian


### Operating systems we test Redis 8.2 on

- Ubuntu 22.04 (Jammy Jellyfish), 24.04 (Noble Numbat)
- Rocky Linux 8.10, 9.5
- AlmaLinux 8.10, 9.5
- Debian 12 (Bookworm)
- macOS 13 (Ventura), 14 (Sonoma), 15 (Sequoia)

### Security fixes (compared to 8.2-RC1)

- (CVE-2025-32023) Fix out-of-bounds write in `HyperLogLog` commands
- (CVE-2025-48367) Retry accepting other connections even if the
accepted connection reports an error

### New Features (compared to 8.2-RC1)

- #14141 Keyspace notifications - new event types:
  - `OVERWRITTEN` - the value of a key is completely overwritten
  - `TYPE_CHANGED` - key type change

### Bug fixes (compared to 8.2-RC1)

- #14162 Crash when using evport with I/O threads
- #14163 `EVAL` crash when error table is empty
- #14144 Vector sets - RDB format is not compatible with big endian
machines
- #14165 Endless client blocking for blocking commands
- #14164 Prevent `CLIENT UNBLOCK` from unblocking `CLIENT PAUSE`
- #14216 TTL was not removed by the `SET` command
- #14224 `HINCRBYFLOAT` removes field expiration on replica

### Performance and resource utilization improvements (compared to
8.2-RC1)

- #14200 Store iterators on stack instead of on heap
- #14144 Vector set - improve RDB loading / RESTORE speed by storing the
worst link info
- #Q6430 More compression variants for the SVS-VAMANA vector index
- #Q6535 `SHARD_K_RATIO` parameter - favor network latency over accuracy
for KNN vector query in a Redis cluster (unstable feature) (MOD-10359)

### Modules API

- #14051 `RedisModule_Get*`, `RedisModule_Set*` - allow modules to
access Redis configurations
- #14114 `RM_UnsubscribeFromKeyspaceEvents` - unregister a module from
specific keyspace notifications
YaacovHazan pushed a commit to YaacovHazan/redis that referenced this pull request Sep 29, 2025
This PR is based on valkey-io/valkey#2117

When a client is blocked by something like `CLIENT PAUSE`, we should not
allow `CLIENT UNBLOCK timeout` to unblock it, since some blocking types
does not has the timeout callback, it will trigger a panic in the core,
people should use `CLIENT UNPAUSE` to unblock it.

Also using `CLIENT UNBLOCK error` is not right, it will return a
UNBLOCKED error to the command, people don't expect a `SET` command to
get an error.

So in this commit, in these cases, we will return 0 to `CLIENT UNBLOCK`
to indicate the unblock is fail. The reason is that we assume that if a
command doesn't expect to be timedout, it also doesn't expect to be
unblocked by `CLIENT UNBLOCK`.

The old behavior of the following command will trigger panic in timeout
and get UNBLOCKED error in error. Under the new behavior, client unblock
will get the result of 0.
```
client 1> client pause 100000 write
client 2> set x x

client 1> client unblock 2 timeout
or
client 1> client unblock 2 error
```

---------

Signed-off-by: Binbin <binloveplay1314@qq.com>
Co-authored-by: Binbin <binloveplay1314@qq.com>
YaacovHazan pushed a commit to YaacovHazan/redis that referenced this pull request Sep 30, 2025
This PR is based on valkey-io/valkey#2117

When a client is blocked by something like `CLIENT PAUSE`, we should not
allow `CLIENT UNBLOCK timeout` to unblock it, since some blocking types
does not has the timeout callback, it will trigger a panic in the core,
people should use `CLIENT UNPAUSE` to unblock it.

Also using `CLIENT UNBLOCK error` is not right, it will return a
UNBLOCKED error to the command, people don't expect a `SET` command to
get an error.

So in this commit, in these cases, we will return 0 to `CLIENT UNBLOCK`
to indicate the unblock is fail. The reason is that we assume that if a
command doesn't expect to be timedout, it also doesn't expect to be
unblocked by `CLIENT UNBLOCK`.

The old behavior of the following command will trigger panic in timeout
and get UNBLOCKED error in error. Under the new behavior, client unblock
will get the result of 0.
```
client 1> client pause 100000 write
client 2> set x x

client 1> client unblock 2 timeout
or
client 1> client unblock 2 error
```

---------

Signed-off-by: Binbin <binloveplay1314@qq.com>
Co-authored-by: Binbin <binloveplay1314@qq.com>
@YaacovHazan YaacovHazan moved this from Todo to pending in Redis 7.2 Backport Sep 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-notes indication that this issue needs to be mentioned in the release notes

Projects

Status: pending
Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants