Skip to content

redis.call doesn't throw lua error when passed nil arguments #651

Description

@timbowhite

Hi, according to the EVAL docs, if "a Redis command call will result into an error, redis.call() will raise a Lua error". But check this out:

redis> eval "redis.call('llen', nil)" 0
(nil)

Command returned ok. But the redis.call did return a lua error:

redis> eval "local res = redis.call('llen', nil) return res" 0
(error) Lua redis() command arguments must be strings or integers

I suppose I was expecting something similar to this to happen:

redis> eval "redis.call('llen')" 0
(error) ERR Error running script (call to f_6fb575faf03c0feac7654c95d6dd9d9de1e75144): Wrong number of args calling Redis command From Lua script

This seems to happen with any command:

redis> eval "redis.call('hset', 'foo', 'bar', nil)" 0
(nil)

Server info:

redis> INFO
# Server
redis_version:2.5.12
redis_git_sha1:00000000
redis_git_dirty:0
os:Linux 2.6.35.11-83.fc14.x86_64 x86_64
arch_bits:64
multiplexing_api:epoll
gcc_version:4.5.1
process_id:17376
run_id:97410b61ad74e0a2819a93bd03762717567059c6
tcp_port:8666
uptime_in_seconds:173406
uptime_in_days:2
lru_clock:409082

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions