You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2020/01/17 02:51:10 UTC
[GitHub] [incubator-apisix] foxhk opened a new issue #1074: bug: module
apisix.balancer not found
foxhk opened a new issue #1074: bug: module apisix.balancer not found
URL: https://github.com/apache/incubator-apisix/issues/1074
### Issue description
2020/01/17 09:44:47 [error] 10554#10554: init_worker_by_lua error: /root/apache-apisix-1.0-incubating/lua/apisix.lua:74:
module 'apisix.balancer' not found:
### Environment
* apisix version (cmd: `apisix version`): apache-apisix-1.0-incubating
* OS: CentOS Linux release 7.7.1908 (Core)
* openresty version: nginx version: openresty/1.15.8.2
### Minimal test code / Steps to reproduce the issue
clean environment, no nginx/openresty/lua
1. install openresty and etcd
# install epel, `luarocks` need it.
wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo rpm -ivh epel-release-latest-7.noarch.rpm
# add OpenResty source
sudo yum install yum-utils
sudo yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo
# install OpenResty, etcd and some compilation tools
sudo yum install -y etcd openresty curl git gcc luarocks lua-devel
# start etcd server
sudo service etcd start
2. install apisix by source release
wget http://www.apache.org/dist/incubator/apisix/1.0/apache-apisix-1.0-incubating-src.tar.gz
tar zxvf apache-apisix-1.0-incubating-src.tar.gz
cd apache-apisix-1.0-incubating
luarocks install lua-resty-worker-events
luarocks install luacheck
make deps
make utils
make lint
make run
### What's the actual result? (including assertion message & call stack if applicable)
curl http://127.0.0.1:9080/apisix/admin/upstreams/1 -X PUT -d '
{
"type": "roundrobin",
"nodes": {
"127.0.0.1:80": 1,
"127.0.0.2:80": 2,
"foo.com:80": 3
}
}'
<html>
<head><title>500 Internal Server Error</title></head>
<body>
<center><h1>500 Internal Server Error</h1></center>
<hr><center>openresty</center>
</body>
</html>
cat logs/error.log
2020/01/17 10:11:04 [error] 23442#23442: init_worker_by_lua error: /root/apache-apisix-1.0-incubating/lua/apisix.lua:74:
module 'apisix.balancer' not found:
no field package.preload['apisix.balancer']
no file '/root/apache-apisix-1.0-incubating//deps/share/lua/5.1/apisix/balancer.lua'
no file '/root/apache-apisix-1.0-incubating/lua/apisix/balancer.lua'
no file '/usr/local/openresty/site/lualib/apisix/balancer.ljbc'
no file '/usr/local/openresty/site/lualib/apisix/balancer/init.ljbc'
no file '/usr/local/openresty/lualib/apisix/balancer.ljbc'
no file '/usr/local/openresty/lualib/apisix/balancer/init.ljbc'
no file '/usr/local/openresty/site/lualib/apisix/balancer.lua'
no file '/usr/local/openresty/site/lualib/apisix/balancer/init.lua'
no file '/usr/local/openresty/lualib/apisix/balancer.lua'
no file '/usr/local/openresty/lualib/apisix/balancer/init.lua'
no file './apisix/balancer.lua'
no file '/usr/local/openresty/luajit/share/luajit-2.1.0-beta3/apisix/balancer.lua'
no file '/usr/local/share/lua/5.1/apisix/balancer.lua'
no file '/usr/local/share/lua/5.1/apisix/balancer/init.lua'
no file '/usr/local/openresty/luajit/share/lua/5.1/apisix/balancer.lua'
no file '/usr/local/openresty/luajit/share/lua/5.1/apisix/balancer/init.lua'
no file '/root/apache-apisix-1.0-incubating/lua/apisix/balancer.lua'
no file '/root/apache-apisix-1.0-incubating/deps/share/lua/5.1/apisix/balancer.lua'
no file './apisix/balancer.lua'
no file '/usr/share/lua/5.1/apisix/balancer.lua'
no file '/usr/share/lua/5.1/apisix/balancer/init.lua'
no file '/usr/lib64/lua/5.1/apisix/balancer.lua'
no file '/usr/lib64/lua/5.1/apisix/balancer/init.lua'
no file '/root/apache-apisix-1.0-incubating//deps/lib64/lua/5.1/apisix/balancer.so'
no file '/root/apache-apisix-1.0-incubating//deps/lib/lua/5.1/apisix/balancer.so'
no file '/usr/local/openresty/site/lualib/apisix/balancer.so'
no file '/usr/local/openresty/lualib/apisix/balancer.so'
no file './apisix/balancer.so'
no file '/usr/local/lib/lua/5.1/apisix/balancer.so'
no file '/usr/local/openresty/luajit/lib/lua/5.1/apisix/balancer.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
no file '/root/apache-apisix-1.0-incubating/deps/lib64/lua/5.1/apisix/balancer.so'
no file './apisix/balancer.so'
no file '/usr/lib64/lua/5.1/apisix/balancer.so'
no file '/usr/lib64/lua/5.1/loadall.so'
no file '/root/apache-apisix-1.0-incubating//deps/lib64/lua/5.1/apisix.so'
no file '/root/apache-apisix-1.0-incubating//deps/lib/lua/5.1/apisix.so'
no file '/usr/local/openresty/site/lualib/apisix.so'
no file '/usr/local/openresty/lualib/apisix.so'
no file './apisix.so'
no file '/usr/local/lib/lua/5.1/apisix.so'
no file '/usr/local/openresty/luajit/lib/lua/5.1/apisix.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
no file '/root/apache-apisix-1.0-incubating/deps/lib64/lua/5.1/apisix.so'
no file './apisix.so'
no file '/usr/lib64/lua/5.1/apisix.so'
no file '/usr/lib64/lua/5.1/loadall.so'
stack traceback:
[C]: in function 'require'
/root/apache-apisix-1.0-incubating/lua/apisix.lua:74: in function 'http_init_worker'
init_worker_by_lua:2: in main chunk
2020/01/17 10:46:22 [error] 23441#23441: *84550 lua entry thread aborted: runtime error: /root/apache-apisix-1.0-incubating/lua/apisix.lua:485: attempt to index upvalue 'router' (a nil value)
stack traceback:
coroutine 0:
/root/apache-apisix-1.0-incubating/lua/apisix.lua: in function 'http_admin'
content_by_lua(nginx.conf:116):2: in main chunk, client: 127.0.0.1, server: , request: "PUT /apisix/admin/upstreams/1 HTTP/1.1", host: "127.0.0.1:9080"
### What's the expected result?
no error, no 500
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-apisix] foxhk closed issue #1074: bug: module
apisix.balancer not found
Posted by GitBox <gi...@apache.org>.
foxhk closed issue #1074: bug: module apisix.balancer not found
URL: https://github.com/apache/incubator-apisix/issues/1074
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-apisix] membphis commented on issue #1074: bug: module
apisix.balancer not found
Posted by GitBox <gi...@apache.org>.
membphis commented on issue #1074: bug: module apisix.balancer not found
URL: https://github.com/apache/incubator-apisix/issues/1074#issuecomment-575445460
The problem is that you put Apache APISIX in the user root directory `/ root /`. After the APISIX Worker process starts, the default user is `nobody`, which does not have permission to read the `/root/` directory. So it will cause fail to load some modules.
Welcome to submit this question to the FAQ, this question is more common.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-apisix] foxhk edited a comment on issue #1074: bug:
module apisix.balancer not found
Posted by GitBox <gi...@apache.org>.
foxhk edited a comment on issue #1074: bug: module apisix.balancer not found
URL: https://github.com/apache/incubator-apisix/issues/1074#issuecomment-575501891
Solving steps:
```
#In apache-apisix-1.0-incubating/ dir
make stop
make clean
rm -rf deps
groupadd apisix && useradd -g apisix apisix && passwd apisix
mv apache-apisix-1.0-incubating* /home/apisix/
#Grant sudo permission
chown -hR apisix:apisix /home/apisix/
su - apisix
#Configure lua environment variables
cd apache-apisix-1.0-incubating
make deps
make utils
sudo make lint
make run
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-apisix] foxhk commented on issue #1074: bug: module
apisix.balancer not found
Posted by GitBox <gi...@apache.org>.
foxhk commented on issue #1074: bug: module apisix.balancer not found
URL: https://github.com/apache/incubator-apisix/issues/1074#issuecomment-575498733
Thx, that's right way.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-apisix] foxhk commented on issue #1074: bug: module
apisix.balancer not found
Posted by GitBox <gi...@apache.org>.
foxhk commented on issue #1074: bug: module apisix.balancer not found
URL: https://github.com/apache/incubator-apisix/issues/1074#issuecomment-575501891
Solving steps:
```
make stop
make clean
rm -rf deps
groupadd apisix && useradd -g apisix apisix && passwd apisix
mv apache-apisix-1.0-incubating* /home/apisix/
#Grant sudo permission
chown -hR apisix:apisix /home/apisix/
su - apisix
#Configure lua environment variables
cd apache-apisix-1.0-incubating
make deps
make utils
sudo make lint
make run
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-apisix] membphis commented on issue #1074: bug: module
apisix.balancer not found
Posted by GitBox <gi...@apache.org>.
membphis commented on issue #1074: bug: module apisix.balancer not found
URL: https://github.com/apache/incubator-apisix/issues/1074#issuecomment-575527533
great
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services