mirror of
https://github.com/hibiken/asynq.git
synced 2026-04-25 23:15:51 +03:00
[PR #1092] Fix nil panic in memoryUsageCmd Lua script #3032
Labels
No labels
CLI
bug
designing
documentation
duplicate
enhancement
good first issue
good first issue
help wanted
idea
invalid
investigate
needs-more-info
performance
pr-welcome
pull-request
question
wontfix
work in progress
work in progress
work-around-available
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/asynq#3032
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/hibiken/asynq/pull/1092
Author: @NilPuig
Created: 2/7/2026
Status: 🔄 Open
Base:
master← Head:fix/memory-usage-nil-guard📝 Commits (1)
2fd155eFix nil guard for MEMORY USAGE in memoryUsageCmd Lua script📊 Changes
1 file changed (+14 additions, -6 deletions)
View changed files
📝
internal/rdb/inspect.go(+14 -6)📄 Description
Summary
MEMORY USAGEreturns nil for Redis keys that no longer exist (e.g., expired or deleted task keys). In Lua, nil is converted tofalse(a boolean). ThememoryUsageCmdscript then attempts arithmetic on this boolean value, causing:This breaks
Inspector.GetQueueInfo()and the/api/queuesendpoint in asynqmon, showing "Could not retrieve queues live data" in the UI.Changes
MEMORY USAGEcalls on task keys (lines 266, 283, 306)agg_task_sample_sizefor the aggregation group sectionHow to reproduce
This happens when task keys referenced in a queue's pending/active/scheduled/retry lists have expired or been deleted from Redis, but the list entries still reference them.
MEMORY USAGEon a non-existent key returns nil, which becomesfalsein Lua.Testing
Tested in production with Redis 7.2.4 and asynq v0.25.1 worker processing ~900K tasks/day. After applying this patch, the
/api/queuesendpoint returns data correctly.Fixes #728
Related to #901
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.