-
Notifications
You must be signed in to change notification settings - Fork 239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pipeline table.insert #2 argument out of bound #43
Comments
But the call to 'client.network.write' adds data to requests If I'm not mistaken: local reply = cmd(client, ...) <--- this will end up inserting data in 'requests' table
-- so here #requests can't be zero
table_insert(parsers, #requests, reply.parser)
return reply |
sounds reasonable, but in particular situation, request is empty, that's a sure thing. and lua don't allow #2 argument to be 0, so an empty table can't use table.insert with #2 argument, which is a strange design i think. |
Do you have a test case to reproduce the error? |
Not sure I understand what the issue is, any tiny snippet of code to reproduce it? |
I'm seeing this issue as well.
local redis = require("redis")
local r = redis.connect()
r:pipeline(function(pipe)
pipe:zadd("FOO", 1, "BAR")
pipe:zadd("FOO", 2, "BAZ")
end)
|
@benwilber Did you find a fix for this? |
I got the same problem, but it seems that it comes from lua version: t = {}
table.insert(t, 1, nil)
print(#t) --> 0, but
table.insert(t, 2, nil) --> no error in 5.2 and 5.3: t = {}
table.insert(t, 1, nil)
print(#t) --> 0
table.insert(t, 2, nil) --> ERROR: bad argument #2 to 'insert' (position out of bounds) corrected for me by changing table_insert(parsers, #requests, reply.parser) by parsers[#requests] = reply.parser I'm working on a more complete patch and I submit a pull request |
…sert(table,pos,value) to table[pos] = value
👍 well done @cedroyer! This seems to affect Lua >= 5.2 indeed. |
I think the correct fix is to change:
to:
This keeps the requests and parsers tables parallel, i.e. for |
I disagree, if you use: use |
in redis.lua file, pipeline function Line 516
request is {}, empty, so #request get 0, it's a bad argument for table.insert
The text was updated successfully, but these errors were encountered: