fix: Use luajit by default when run APISIX CLI#3335
Conversation
| luarocks install rockspec/apisix-master-0.rockspec --tree=deps --only-deps --local | ||
| endif | ||
| ifneq ($(LUA_VER),Lua 5.1) | ||
| sed -i '' -e "s|#!/usr/bin/env lua|#!/usr/bin/env $(LUAJIT_DIR)/bin/luajit|g" ./bin/apisix |
There was a problem hiding this comment.
this is a hack way. it should not be enough.
here is another way, we can make a try:
#!/bin/sh
# find the openresty, eg: which openresty
...
# find the luajit of openresty
...
# run the CLI of APISIX
$luajit -e '...'There was a problem hiding this comment.
@membphis
I don't understand very clearly.
Do you mean to create a new shell script to judge whether to use lua5.1 or luajit when running the CLI of APISIX?
It could run the CLI of APISIX selectively: lua ./bin/apisix or luajit -e ./bin/apisix?
There was a problem hiding this comment.
we can use a shell script to write the CLI, it'll to call luajit ./bin/apisix
32bbf86 to
065a44e
Compare
|
@membphis Could you review commit 065a44 for me? Thank you. By the way, about CI error: |
membphis
left a comment
There was a problem hiding this comment.
can we put this file bin/apisix.lua to apisix/cli?
|
2f04024 to
c0d7384
Compare
ae0ab58 to
e44bdfc
Compare
|
please merge the code of master branch, CI failed ^_^ |
612eccc to
519b4f6
Compare
| -- modify the load path to load our dependencies | ||
| package.cpath = pkg_cpath .. pkg_cpath_org | ||
| package.path = pkg_path .. pkg_path_org | ||
| if [[ "$LUA_VERSION" =~ "Lua 5.1" && $USE_LUA ]]; then |
There was a problem hiding this comment.
this is wrong. we should always use luajit of openresty
| -- modify the load path to load our dependencies | ||
| package.cpath = pkg_cpath .. pkg_cpath_org | ||
| package.path = pkg_path .. pkg_path_org | ||
| if [[ "$LUA_VERSION" =~ "Lua 5.1" && $USE_LUA ]]; then |
There was a problem hiding this comment.
this is wrong. we should always use luajit of openresty
There was a problem hiding this comment.
if we always use luajit of openresty , it will be a big chage for old users . so we think maybe we should leave a way for old users ?
There was a problem hiding this comment.
this is fine for the old users, sure for this
519b4f6 to
8911df5
Compare
| .. apisix_home .. "/deps/lib/lua/5.1/?.so;;" | ||
| local pkg_path = apisix_home .. "/deps/share/lua/5.1/?.lua;;" | ||
| # find the openresty | ||
| OR_EXEC=$(which openresty) |
There was a problem hiding this comment.
This step may fail, and we need to do some exception checks.
If the openresty command is not found, you can actively determine whether there is this directory in /usr/local/openresty.
There was a problem hiding this comment.
thrown an error if failed to find the openresty
There was a problem hiding this comment.
208613a to
5583dac
Compare
membphis
left a comment
There was a problem hiding this comment.
LGTM, ci failed, need you to process it
|
@spacewander told me that, this is a bug of openresty do you have any suggestions about this? luajit: lj_asm_x86.h:2819: asm_loop_fixup: Assertion `((intptr_t)target & 15) == 0' failed.
./bin/apisix: line 40: 24266 Aborted (core dumped) $LUAJIT_BIN $APISIX_LUA $*
Error: Process completed with exit code 134. |
|
The problem occurs with |
|
About the bug of
|
I think this is fine. you can make a try ^_^ |
|
@fukiki I think the title can be changed :), we only want to run APISIX CLI with LuaJIT. |
ef3847e to
70e5eaa
Compare
About the bug of openresty-debug, only using OpenResty 1.19 not Lua 5.1? |
531e38b to
818fe47
Compare
@membphis I've already done, could you review my pr please? Than you. |
let me take a look. many thx for your nice job |
|
@fukiki I think we can merge this PR soon ^_^ |
6b70000 to
ac25353
Compare
|
@membphis The |
ac25353 to
a4fd95e
Compare
|
|
||
| - If you want use Tengine instead of OpenResty, please take a look at this installation step script [Install Tengine at Ubuntu](../.travis/linux_tengine_runner.sh). | ||
|
|
||
| - By default Apache APISIX runs with luajit of OpenResty 1.19 (priority) or Lua 5.1. If you run in to an issue `luajit: lj_asm_x86.h:2819: asm_loop_fixup: Assertion '((intptr_t)target & 15) == 0' failed`, it is caused by to the compatibility of OpenResty version. OpenResty 1.19 is recommended, please take a look at this installation step script [linux-install-openresty](../utils/linux-install-openresty.sh). |
There was a problem hiding this comment.
Apache APISIX runs with luajit -> Apache APISIX runs with LuaJIT
There was a problem hiding this comment.
@membphis I submitted about the style things.
| ifeq ("$(wildcard /usr/local/openresty-debug/bin/openresty)", "") | ||
| @echo "ERROR: OpenResty not found. You have to install OpenResty and add the binary file to PATH before install Apache APISIX." | ||
| exit 1 | ||
| else |
There was a problem hiding this comment.
What about echoing a warn message here?
There was a problem hiding this comment.
@tokers The warn message will be better, I've submitted.
Just reviewed. |
Signed-off-by: fukiki <[email protected]>
a4fd95e to
2a032d6
Compare
|
@fukiki many thx, merge already |
Signed-off-by: fukiki [email protected]
What this PR does / why we need it:
When run APISIX, use LuaJIT or Lua 5.1 by default.
If the local lua version is not 5.1, use openresty-luajit as default.
Fix : #3281
Pre-submission checklist: