LuaJIT诡异bug(疑似)

程序为单进程多线程

每个线程开启一个LuaJIT虚拟机,版本为LuaJIT 2.1.0-beta3

在高并发情况下,lua代码会出现诡异情况,例如:

if true then
    if xxx == 1 then
        error("err")
    end
else
    if xxx ~= 1 then
        error("err")
    end

    if not xxx == 1 then
        error("err")
    end
end

 当xxx为1时,按理应该 xxx ~= 1为false,但是很奇怪的是反而为true。只有 not xxx == 1才为false

 

当把每个线程拆为独立进程后,此诡异情况消失。

故猜测是luajit问题。

 

ps.暂时无法用独立的测试用例来重现此问题。

posted @ 2020-08-26 13:38  lcinx  阅读(871)  评论(0编辑  收藏  举报