Closed coanor closed 10 years ago
I confirm this issue, please fix.
This problem could be fixed by changing these two lines of the command serialization in a way that the iteration of command arguments wouldn't break anymore when nil
is the first value and and all nil
s would be converted to empty strings. Basically, something like this:
for i = 1, argsn do
local s_argument = tostring(args[i] or '')
Please note that Redis actually accepts empty strings as keys, so redis.set(nil, "foobar")
won't return any error and the server will store the string "foobar"
into the key ""
(empty string). This can be easily tested by doing:
client:set("", "foobar")
local value = client:get("")
print(value) -- prints "foobar"
I have wrapped the redis command as:
and I call
redis_cmd
like that:while the command need 2 or more parameters(i.e., lrange, set, and so on), and the
key
isnil
, theredis_cmd
will hang there without any error message. And I added aif
judgement(XXX:
) on this situation, but while I call multi-set like this:it still hang, I think my
if
statement do nothing with this situation. Is it a bug in redis.lua?Add just for more information: After testing in LuaJIT 2.0.1, the form:
will not hang and return
true
, but the form still hang.Git update hist: