doujiang24 / lua-resty-kafka

Lua kafka client driver for the Openresty based on the cosocket API
BSD 3-Clause "New" or "Revised" License
801 stars 274 forks source link

lua entry thread aborted: runtime error: /app/nginx-1.12.1/lua/lib/resty/kafka/request.lua:73: bad argument #1 to 'rshift' (number expected, got cdata) #139

Open xiaocaichao opened 2 years ago

xiaocaichao commented 2 years ago

报错如下 请教下如何解决? 2022/06/10 16:01:05 [error] 15470#0: 6042419 lua entry thread aborted: runtime error: /app/nginx-1.12.1/lua/lib/resty/kafka/request.lua:73: bad argument #1 to 'rshift' (number expected, got cdata) stack traceback: coroutine 0: [C]: in function 'rshift' /app/nginx-1.12.1/lua/lib/resty/kafka/request.lua:73: in function 'str_int64' /app/nginx-1.12.1/lua/lib/resty/kafka/request.lua:248: in function 'message_set' /app/nginx-1.12.1/lua/lib/resty/kafka/producer.lua:79: in function 'produce_encode' /app/nginx-1.12.1/lua/lib/resty/kafka/producer.lua:157: in function '_send' /app/nginx-1.12.1/lua/lib/resty/kafka/producer.lua:209: in function '_batch_send' /app/nginx-1.12.1/lua/lib/resty/kafka/producer.lua:256: in function </app/nginx-1.12.1/lua/lib/resty/kafka/producer.lua:229>, context: ngx.timer, client: 10..., server: 0.0.0.0:8888

相关版本如下 nginx-1.12.1 LuaJIT-2.0.5 lua-nginx-module-0.10.10

Pink-Maserati commented 1 year ago

请问你最后有解决吗?我也遇到了

doujiang24 commented 1 year ago

这个错误看起来不太正常,可能是 LuaJIT 版本太低,或者编译选项的问题 请用 OpenResty 官方版本测试下呢?

doujiang24 commented 1 year ago

另外,这个错误是一直会出现,还是偶尔出现呢?

Pink-Maserati commented 1 year ago

它一直出现,我早上最后参考https://github.com/doujiang24/lua-resty-kafka/issues/82 这个把str_int64换了之后运行好了

doujiang24 commented 1 year ago

那就是用了标准 Lua,没有用 luajit ?还是没太明白

Pink-Maserati commented 1 year ago

我没用 OpenResty ,因为我之前的nginx是用yum方式安装的,然后平滑升级添加了lua-nginx-module模块,期间有安装luajit。

doujiang24 commented 1 year ago

这个设计之初,就只考虑了 OpenResty/LuaJIT 呢 如果是 OpenResty/LuaJIT 应该是没有问题的,建议你使用 OpenResty 的官方安装包

如果有你有兴趣支持非标准 OpenResty/LuaJIT 的话,欢迎 PR ~ 不过 #82 中的修复,我初步看下来,感觉不太对的样子

Pink-Maserati commented 1 year ago

好的