[GH-ISSUE #655] [BUG] Some Redis hset command parameter issues on different platform versions need to be fixed #1341

Open
opened 2026-03-07 22:08:46 +03:00 by kerem · 0 comments
Owner

Originally created by @wenlng on GitHub (May 6, 2023).
Original GitHub issue: https://github.com/hibiken/asynq/issues/655

Originally assigned to: @hibiken on GitHub.

I got this error asynq

for example: run TestSchedule() is bug of asynq/internal/rdb_test.go [lineNumber: 1404]

/Users/awen/sdk/go/go1.19.3/bin/go tool test2json -t /private/var/folders/asynq_internal_rdb.test -test.v -test.paniconexit0 -test.run ^\QTestSchedule\E$
=== RUN TestSchedule

rdb_test.go:1420: (*RDB).Schedule(&{send_email [123 34 115 117 98 106 101 99 116 34 58 34 104 101 108 108 111 34 125] 32aeac9e-3582-4387-9c40-0d8f34af034c default 25 0 0 1800 0 0 0}, 2023-05-07 01:22:58.211971 +0800 CST m=+900.009080521) = UNKNOWN: redis eval error: ERR Error running script (call to f_8ce6b38a99b73194585c251eb3c2a89559f37a87): @user_script:5: @user_script: 5: Wrong number of args calling Redis command From Lua script , want nil
--- FAIL: TestSchedule (0.01s)

FAIL

Process finished with the exit code 1

========================================================================================================================================================================================

The Redis hset command does not support more than three parameters in certain versions


for example: asynq/internal/rdb/rdb.go [lineNumber: 96]

var enqueueCmd = redis.NewScript(`
if redis.call("EXISTS", KEYS[1]) == 1 then
	return 0
end
redis.call("HSET", KEYS[1], "msg", ARGV[1], "state", "pending", "pending_since", ARGV[3])
redis.call("LPUSH", KEYS[2], ARGV[2])
return 1
`)

To support some platform versions of Redis, it needs to be changed to the following content

var enqueueCmd = redis.NewScript(`
if redis.call("EXISTS", KEYS[1]) == 1 then
	return 0
end
redis.call("HSET", KEYS[1], "msg", ARGV[1])
redis.call("HSET", KEYS[1], "state", "pending")
redis.call("HSET", KEYS[1], "pending_since", ARGV[3])
redis.call("LPUSH", KEYS[2], ARGV[2])
return 1
`)

======================== RDB.RedisInfo() ===============================

map[aof_current_rewrite_time_sec:-1 aof_enabled:0 aof_last_bgrewrite_status:ok aof_last_rewrite_time_sec:-1
aof_last_write_status:ok aof_rewrite_in_progress:0 aof_rewrite_scheduled:0 arch_bits:64 blocked_clients:0 
client_biggest_input_buf:0 client_longest_output_list:0 cluster_enabled:0 config_file:/usr/local/etc/redis.conf 
connected_clients:6 connected_slaves:0 db0:keys=8,expires=3,avg_ttl=6130334294 evicted_keys:0 
executable:/usr/local/opt/redis@3.2/bin/redis-server expired_keys:97 gcc_version:4.2.1 hz:10 instantaneous_input_kbps:0.37
 instantaneous_ops_per_sec:4 instantaneous_output_kbps:0.01 keyspace_hits:3097 keyspace_misses:12827 
latest_fork_usec:403 loading:0 lru_clock:5704154 master_repl_offset:0 maxmemory:0 maxmemory_human:0B 
maxmemory_policy:noeviction mem_allocator:libc mem_fragmentation_ratio:1.88 migrate_cached_sockets:0 
multiplexing_api:kqueue os:Darwin 21.3.0 x86_64 process_id:907 pubsub_channels:1 pubsub_patterns:0 
rdb_bgsave_in_progress:0 rdb_changes_since_last_save:1507 rdb_current_bgsave_time_sec:-1 rdb_last_bgsave_status:ok 
rdb_last_bgsave_time_sec:0 rdb_last_save_time:1683425683 redis_build_id:27b4200084fe134 redis_git_dirty:0 
redis_git_sha1:00000000 redis_mode:standalone redis_version:3.2.13 rejected_connections:0 repl_backlog_active:0 
repl_backlog_first_byte_offset:0 repl_backlog_histlen:0 repl_backlog_size:1048576 role:master 
run_id:feb798a451b4fc207caa046bb5f961c2d378c729 sync_full:0 sync_partial_err:0 sync_partial_ok:0 tcp_port:6379 
total_commands_processed:153453 total_connections_received:517 total_net_input_bytes:12784050 
total_net_output_bytes:777209 total_system_memory:17179869184 total_system_memory_human:16.00G 
uptime_in_days:1 uptime_in_seconds:127046 used_cpu_sys:15.74 used_cpu_sys_children:0.36 used_cpu_user:9.32 
used_cpu_user_children:0.07 used_memory:1220256 used_memory_human:1.16M used_memory_lua:133120 
used_memory_lua_human:130.00K used_memory_peak:1876096 used_memory_peak_human:1.79M 
used_memory_rss:2293760 used_memory_rss_human:2.19M] is missing entry for "used_memory_peak_perc"
Originally created by @wenlng on GitHub (May 6, 2023). Original GitHub issue: https://github.com/hibiken/asynq/issues/655 Originally assigned to: @hibiken on GitHub. ## I got this error asynq for example: run TestSchedule() is bug of asynq/internal/rdb_test.go [lineNumber: 1404] /Users/awen/sdk/go/go1.19.3/bin/go tool test2json -t /private/var/folders/asynq_internal_rdb.test -test.v -test.paniconexit0 -test.run ^\QTestSchedule\E$ === RUN TestSchedule rdb_test.go:1420: (*RDB).Schedule(&{send_email [123 34 115 117 98 106 101 99 116 34 58 34 104 101 108 108 111 34 125] 32aeac9e-3582-4387-9c40-0d8f34af034c default 25 0 0 1800 0 0 0}, 2023-05-07 01:22:58.211971 +0800 CST m=+900.009080521) = UNKNOWN: redis eval error: ERR Error running script (call to f_8ce6b38a99b73194585c251eb3c2a89559f37a87): @user_script:5: @user_script: 5: Wrong number of args calling Redis command From Lua script , want nil --- FAIL: TestSchedule (0.01s) FAIL Process finished with the exit code 1 ======================================================================================================================================================================================== ## The Redis hset command does not support more than three parameters in certain versions ------------------------------ for example: asynq/internal/rdb/rdb.go [lineNumber: 96] ``` var enqueueCmd = redis.NewScript(` if redis.call("EXISTS", KEYS[1]) == 1 then return 0 end redis.call("HSET", KEYS[1], "msg", ARGV[1], "state", "pending", "pending_since", ARGV[3]) redis.call("LPUSH", KEYS[2], ARGV[2]) return 1 `) ``` ----------------------------------- To support some platform versions of Redis, it needs to be changed to the following content ----------------------------------- ``` var enqueueCmd = redis.NewScript(` if redis.call("EXISTS", KEYS[1]) == 1 then return 0 end redis.call("HSET", KEYS[1], "msg", ARGV[1]) redis.call("HSET", KEYS[1], "state", "pending") redis.call("HSET", KEYS[1], "pending_since", ARGV[3]) redis.call("LPUSH", KEYS[2], ARGV[2]) return 1 `) ``` ======================== RDB.RedisInfo() =============================== ``` map[aof_current_rewrite_time_sec:-1 aof_enabled:0 aof_last_bgrewrite_status:ok aof_last_rewrite_time_sec:-1 aof_last_write_status:ok aof_rewrite_in_progress:0 aof_rewrite_scheduled:0 arch_bits:64 blocked_clients:0 client_biggest_input_buf:0 client_longest_output_list:0 cluster_enabled:0 config_file:/usr/local/etc/redis.conf connected_clients:6 connected_slaves:0 db0:keys=8,expires=3,avg_ttl=6130334294 evicted_keys:0 executable:/usr/local/opt/redis@3.2/bin/redis-server expired_keys:97 gcc_version:4.2.1 hz:10 instantaneous_input_kbps:0.37 instantaneous_ops_per_sec:4 instantaneous_output_kbps:0.01 keyspace_hits:3097 keyspace_misses:12827 latest_fork_usec:403 loading:0 lru_clock:5704154 master_repl_offset:0 maxmemory:0 maxmemory_human:0B maxmemory_policy:noeviction mem_allocator:libc mem_fragmentation_ratio:1.88 migrate_cached_sockets:0 multiplexing_api:kqueue os:Darwin 21.3.0 x86_64 process_id:907 pubsub_channels:1 pubsub_patterns:0 rdb_bgsave_in_progress:0 rdb_changes_since_last_save:1507 rdb_current_bgsave_time_sec:-1 rdb_last_bgsave_status:ok rdb_last_bgsave_time_sec:0 rdb_last_save_time:1683425683 redis_build_id:27b4200084fe134 redis_git_dirty:0 redis_git_sha1:00000000 redis_mode:standalone redis_version:3.2.13 rejected_connections:0 repl_backlog_active:0 repl_backlog_first_byte_offset:0 repl_backlog_histlen:0 repl_backlog_size:1048576 role:master run_id:feb798a451b4fc207caa046bb5f961c2d378c729 sync_full:0 sync_partial_err:0 sync_partial_ok:0 tcp_port:6379 total_commands_processed:153453 total_connections_received:517 total_net_input_bytes:12784050 total_net_output_bytes:777209 total_system_memory:17179869184 total_system_memory_human:16.00G uptime_in_days:1 uptime_in_seconds:127046 used_cpu_sys:15.74 used_cpu_sys_children:0.36 used_cpu_user:9.32 used_cpu_user_children:0.07 used_memory:1220256 used_memory_human:1.16M used_memory_lua:133120 used_memory_lua_human:130.00K used_memory_peak:1876096 used_memory_peak_human:1.79M used_memory_rss:2293760 used_memory_rss_human:2.19M] is missing entry for "used_memory_peak_perc" ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/asynq#1341
No description provided.