xpol / lua-rapidjson

A JSON module for Lua based on the very fast RapidJSON library.
MIT License
280 stars 65 forks source link

Illegal instruction (core dumped) in aws ec2 #56

Open guy-otonomo opened 1 year ago

guy-otonomo commented 1 year ago
bash-5.1# lua
LuaJIT 2.1.0-beta3 -- Copyright (C) 2005-2020 Mike Pall. https://luajit.org/
JIT: ON SSE3 SSE4.1 BMI2 fold cse dce fwd dse narrow loop abc sink fuse
> json = require "rapidjson"
> print(json.encode({a=5}))
Illegal instruction (core dumped)
> uname -a
Linux 4e0e39d6702b 4.14.252-195.483.amzn2.x86_64 #1 SMP Mon Nov 1 20:58:46 UTC 2021 x86_64 Linux

Notes: we use rapidjson inside Kong.

Will be happy to provide any more info.

xpol commented 1 year ago

I have no idea on that, but after a simple googling, I found this page maybe help: https://groups.google.com/g/OpenResty/c/EC_ohjV5ROA

I think it's due to incorrect configuration flags passed when you compile the LuaJIT. Have you tried loading other libraries?

And you can try to comment the SSE related lines https://github.com/xpol/lua-rapidjson/blob/master/src/rapidjson.cpp#L10-L14

See if it helps.

guy-otonomo commented 1 year ago

Well, not a simple search, because results are in Chinese 😅 Thanks for your help, it does seems to explain the issue (compiled version vs runtime version). Other plugins seem to work OK BTW.

Commenting out those lines, should be done before building rapidjson, right? (we install it via luarocks, so this is going to be a hard one). We should also try a machine in AWS that supports sse4_2.

Thanks again.