mirror of
https://github.com/hanzoai/kv.git
synced 2026-11-21 08:42:06 +00:00
Remove -encoding binary from fconfigure as it is no longer supported in Tcl 9 (Fedora Rawhide and Daily / test-fedoralatest-jemalloc (pull_request)). -translation binary alone is sufficient. ``` https://github.com/valkey-io/valkey/actions/runs/22324297258/job/64590589777?pr=3225 ===== Start of server log (pid 17617) ===== ### Starting server for test 17617:M 23 Feb 2026 21:21:47.846 # WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect. 17617:M 23 Feb 2026 21:21:47.846 * oO0OoO0OoO0Oo Valkey is starting oO0OoO0OoO0Oo 17617:M 23 Feb 2026 21:21:47.846 * Valkey version=9.0.3, bits=64, commit=00000000, modified=0, pid=17617, just started 17617:M 23 Feb 2026 21:21:47.846 * Configuration loaded 17617:M 23 Feb 2026 21:21:47.847 * monotonic clock: POSIX clock_gettime .+^+. .+#########+. .+########+########+. Valkey 9.0.3 (00000000/0) 64 bit .+########+' '+########+. .########+' .+. '+########. Running in cluster mode |####+' .+#######+. '+####| Port: 25121 |###| .+###############+. |###| PID: 17617 |###| |#####*'' ''*#####| |###| |###| |####' .-. '####| |###| |###| |###( (@@@) )###| |###| https://valkey.io/ |###| |####. '-' .####| |###| |###| |#####*. .*#####| |###| |###| '+#####| |#####+' |###| |####+. +##| |#+' .+####| '#######+ |##| .+########' '+###| |##| .+########+' '| |####+########+' +#########+' '+v+' 17617:M 23 Feb 2026 21:21:47.849 * No cluster configuration found, I'm 5501916ccdf76dee6b652cab10402cab3a8f9152 17617:M 23 Feb 2026 21:21:47.852 * Server initialized 17617:M 23 Feb 2026 21:21:47.852 * Ready to accept connections tcp 17617:M 23 Feb 2026 21:21:47.852 * Ready to accept connections unix 17617:M 23 Feb 2026 21:21:47.963 - Accepted 127.0.0.1:37791 17617:M 23 Feb 2026 21:21:47.963 - Client closed connection id=2 addr=127.0.0.1:37791 laddr=127.0.0.1:25121 fd=12 name= age=0 idle=0 flags=N capa= db=0 sub=0 psub=0 ssub=0 multi=-1 watch=0 qbuf=0 qbuf-free=20474 argv-mem=0 multi-mem=0 rbs=16384 rbp=16384 obl=0 oll=0 omem=0 tot-mem=37504 events=r cmd=ping user=default redir=-1 resp=2 lib-name= lib-ver= tot-net-in=7 tot-net-out=7 tot-cmds=1 17617:M 23 Feb 2026 21:21:47.969 - Accepted 127.0.0.1:39251 17617:M 23 Feb 2026 21:21:47.970 * configEpoch set to 1 via CLUSTER SET-CONFIG-EPOCH 17617:M 23 Feb 2026 21:21:47.975 # Missing implement of connection type tls 17617:M 23 Feb 2026 21:21:47.976 # DEBUG LOG: ========== I am primary 0 ========== 17617:M 23 Feb 2026 21:21:49.872 * Cluster state changed: ok ### Starting test Packet with missing gossip messages don't cause invalid read in tests/unit/cluster/packet.tcl 17617:M 23 Feb 2026 21:21:49.879 - Accepting cluster node connection from 127.0.0.1:33701 17617:M 23 Feb 2026 21:21:49.880 - Client closed connection id=3 addr=127.0.0.1:39251 laddr=127.0.0.1:25121 fd=12 name= age=2 idle=0 flags=N capa= db=0 sub=0 psub=0 ssub=0 multi=-1 watch=0 qbuf=0 qbuf-free=20474 argv-mem=0 multi-mem=0 rbs=1024 rbp=426 obl=0 oll=0 omem=0 tot-mem=22144 events=r cmd=cluster|info user=default redir=-1 resp=2 lib-name= lib-ver= tot-net-in=1363 tot-net-out=17324 tot-cmds=47 17617:signal-handler (1771881709) Received SIGTERM scheduling shutdown... 17617:M 23 Feb 2026 21:21:49.973 * User requested shutdown... 17617:M 23 Feb 2026 21:21:49.973 * Removing the pid file. 17617:M 23 Feb 2026 21:21:49.973 * Saving the cluster configuration file before exiting. 17617:M 23 Feb 2026 21:21:49.978 * Removing the unix socket file. 17617:M 23 Feb 2026 21:21:49.978 # Valkey is now ready to exit, bye bye... ===== End of server log (pid 17617) ===== ===== Start of server stderr log (pid 17617) ===== ===== End of server stderr log (pid 17617) ===== [exception]: Executing test client: unknown encoding "binary": No longer supported. please use either "-translation binary" or "-encoding iso8859-1". unknown encoding "binary": No longer supported. please use either "-translation binary" or "-encoding iso8859-1" while executing "fconfigure $sock -translation binary -encoding binary -buffering none -blocking 1" ("uplevel" body line 18) invoked from within "uplevel 1 $code" (procedure "test" line 62) invoked from within "test "Packet with missing gossip messages don't cause invalid read" { set base_port [srv 0 port] set cluster_port [expr {$base_port + ..." ("uplevel" body line 2) invoked from within "uplevel 1 $code" (procedure "cluster_setup" line 41) invoked from within "cluster_setup 1 0 1 continuous_slot_allocation default_replica_allocation { test "Packet with missing gossip messages don't cause invalid read" { ..." ("uplevel" body line 1) invoked from within "uplevel 1 $code " (procedure "start_server" line 2) invoked from within "start_server {overrides {cluster-enabled yes cluster-ping-interval 100 cluster-node-timeout 3000 cluster-databases 16 cluster-slot-stats-enabled yes} ..." ("uplevel" body line 1) invoked from within "uplevel 1 $code" (procedure "start_multiple_servers" line 5) invoked from within "start_multiple_servers $node_count $options $code" (procedure "start_cluster" line 17) invoked from within "start_cluster 1 0 {tags {external:skip cluster tls:skip}} { test "Packet with missing gossip messages don't cause invalid read" { set base..." (file "tests/unit/cluster/packet.tcl" line 84) invoked from within "source $path" (procedure "execute_test_file" line 4) invoked from within "execute_test_file $data" (procedure "test_client_main" line 10) invoked from within "test_client_main $::test_server_port " Killing still running Valkey server 10700 Killing still running Valkey server 11659 Killing still running Valkey server 11705 Killing still running Valkey server 12735 Killing still running Valkey server 12775 Killing still running Valkey server 12808 Killing still running Valkey server 12858 Killing still running Valkey server 12901 Killing still running Valkey server 12940 Killing still running Valkey server 12972 Killing still running Valkey server 13004 Killing still running Valkey server 13036 Killing still running Valkey server 13073 Killing still running Valkey server 14952 Killing still running Valkey server 16631 Killing still running Valkey server 16670 Killing still running Valkey server 16686 Killing still running Valkey server 16702 Killing still running Valkey server 16718 Killing still running Valkey server 16734 Killing still running Valkey server 16753 Killing still running Valkey server 16771 Killing still running Valkey server 17094 Killing still running Valkey server 17112 Killing still running Valkey server 17133 Killing still running Valkey server 17262 Killing still running Valkey server 17278 Killing still running Valkey server 17316 Killing still running Valkey server 17349 Killing still running Valkey server 17379 Killing still running Valkey server 17410 Killing still running Valkey server 17430 Killing still running Valkey server 17443 Killing still running Valkey server 17459 Killing still running Valkey server 17478 Killing still running Valkey server 17491 Killing still running Valkey server 17507 Killing still running Valkey server 17526 Killing still running Valkey server 17545 Killing still running Valkey server 17561 Killing still running Valkey server 17577 Killing still running Valkey server 17716 Killing still running Valkey server 17778 Killing still running Valkey server 17825 Killing still running Valkey server 17848 Killing still running Valkey server 17896 Killing still running Valkey server 17931 Killing still running Valkey server 17953 Killing still running Valkey server 17973 Killing still running Valkey server 17991 Killing still running Valkey server 18010 Killing still running Valkey server 18064 Killing still running Valkey server 18082 Killing still running Valkey server 18134 Killing still running Valkey server 18118 Killing still running Valkey server 18150 Killing still running Valkey server 18166 Killing still running Valkey server 18188 Killing still running Valkey server 18209 ``` Signed-off-by: Roshan Khatri <[email protected]>
114 lines
3.6 KiB
Tcl
114 lines
3.6 KiB
Tcl
# Test that cluster bus messages with certain invalid packets are rejected
|
|
# and don't crash the system.
|
|
proc create_cluster_meet_packet {sender_name sender_port sender_cport} {
|
|
# Constants
|
|
set CLUSTER_NAMELEN 40
|
|
set CLUSTER_SLOTS 16384
|
|
set NET_IP_STR_LEN 46
|
|
set CLUSTERMSG_TYPE_MEET 2
|
|
|
|
# Build the packet
|
|
set packet ""
|
|
|
|
# Signature "RCmb" (4 bytes)
|
|
append packet "RCmb"
|
|
|
|
# totlen (uint32_t) - will be updated at the end
|
|
append packet [binary format I 0]
|
|
|
|
# ver (uint16_t) - protocol version 1
|
|
append packet [binary format S 1]
|
|
|
|
# port (uint16_t)
|
|
append packet [binary format S $sender_port]
|
|
|
|
# type (uint16_t) - MEET
|
|
append packet [binary format S $CLUSTERMSG_TYPE_MEET]
|
|
|
|
# count (uint16_t) - 100 gossip messages
|
|
# Value intentionally set to a high value, even though no gossip
|
|
# messages are included.
|
|
append packet [binary format S 100]
|
|
|
|
# currentEpoch (uint64_t)
|
|
append packet [binary format W 1]
|
|
|
|
# configEpoch (uint64_t)
|
|
append packet [binary format W 1]
|
|
|
|
# offset (uint64_t)
|
|
append packet [binary format W 0]
|
|
|
|
# sender[40] - node name
|
|
set sender_padded [string range "${sender_name}[string repeat "\x00" $CLUSTER_NAMELEN]" 0 [expr {$CLUSTER_NAMELEN - 1}]]
|
|
append packet $sender_padded
|
|
|
|
# myslots[2048] - all zeros
|
|
append packet [string repeat "\x00" [expr {$CLUSTER_SLOTS / 8}]]
|
|
|
|
# replicaof[40] - all zeros
|
|
append packet [string repeat "\x00" $CLUSTER_NAMELEN]
|
|
|
|
# myip[46] - all zeros
|
|
append packet [string repeat "\x00" $NET_IP_STR_LEN]
|
|
|
|
# extensions (uint16_t) - Set to 2
|
|
append packet [binary format S 2000000000]
|
|
|
|
# notused1[30] - reserved
|
|
append packet [string repeat "\x00" 30]
|
|
|
|
# pport (uint16_t)
|
|
append packet [binary format S 0]
|
|
|
|
# cport (uint16_t) - cluster bus port
|
|
append packet [binary format S $sender_cport]
|
|
|
|
# flags (uint16_t) - CLUSTER_NODE_PRIMARY
|
|
append packet [binary format S 1]
|
|
|
|
# state (unsigned char) - CLUSTER_OK
|
|
append packet [binary format c 0]
|
|
|
|
# mflags[3] - message flags (WITH CLUSTERMSG_FLAG0_EXT_DATA flag set)
|
|
# CLUSTERMSG_FLAG0_EXT_DATA = (1 << 2) = 4
|
|
append packet [binary format ccc 4 0 0]
|
|
|
|
# Update totlen
|
|
set totlen [string length $packet]
|
|
set packet [string replace $packet 4 7 [binary format I $totlen]]
|
|
|
|
return $packet
|
|
}
|
|
|
|
start_cluster 1 0 {tags {external:skip cluster tls:skip}} {
|
|
test "Packet with missing gossip messages don't cause invalid read" {
|
|
set base_port [srv 0 port]
|
|
set cluster_port [expr {$base_port + 10000}]
|
|
set fake_node_id "abcdef1234567890abcdef1234567890abcdef12"
|
|
|
|
# Get initial total messages received
|
|
set info_before [R 0 cluster info]
|
|
regexp {cluster_stats_messages_received:(\d+)} $info_before -> initial_received
|
|
|
|
# Create a packet with extensions=0 but CLUSTERMSG_FLAG0_EXT_DATA flag set
|
|
set packet [create_cluster_meet_packet $fake_node_id $base_port $cluster_port]
|
|
|
|
# Verify packet length
|
|
set packet_len [string length $packet]
|
|
|
|
# Send the packet after configuring the socket to accept binary data
|
|
set sock [socket 127.0.0.1 $cluster_port]
|
|
fconfigure $sock -translation binary -buffering none -blocking 1
|
|
puts -nonewline $sock $packet
|
|
flush $sock
|
|
close $sock
|
|
|
|
wait_for_condition 1000 10 {
|
|
[CI 0 cluster_stats_messages_received] == 1
|
|
} else {
|
|
fail "Packet was never received"
|
|
}
|
|
}
|
|
}
|