openresty / luajit2

OpenResty's Branch of LuaJIT 2
https://luajit.org/luajit.html
Other
1.2k stars 193 forks source link

iterate over non-empty table got empty #181

Open zhuizhuhaomeng opened 1 year ago

zhuizhuhaomeng commented 1 year ago

The original issue was reported in google group.

https://groups.google.com/g/openresty-en/c/4DXfmYSU7Jo/m/bUajTOB0AQAJ?utm_medium=email&utm_source=footer

i am testing my proxy server by new version of openresty (1.21.4), and i have a big problem in load test my nginx config just :worker 1; and i have some code like this:

rewrite_by_lua_block {
    local t = {["1.2.3.4"] = { ["weight"] = 1}, ["4.5.6.7"] = { ["weight"] = 2}}
    ngx.ctx.t = t
}

balancer_by_lua_block{
    localt = ngx.ctx.t
    for key, value in pairs(t) do print(key) end -- output is empty
    for key, value in pairs(t) do print(key) end -- have output
}
zhuizhuhaomeng commented 1 year ago

@XmiliaH would you please have a look at this issue?

XmiliaH commented 1 year ago

I would say this might be fixed in https://github.com/LuaJIT/LuaJIT/commit/32984282ddae666b3c94cd27538e1c78b49a1877.

zhuizhuhaomeng commented 1 year ago

thank you