Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

测试url打开提示500错误 #79

Open
lvelvis opened this issue Sep 13, 2017 · 2 comments
Open

测试url打开提示500错误 #79

lvelvis opened this issue Sep 13, 2017 · 2 comments

Comments

@lvelvis
Copy link

lvelvis commented Sep 13, 2017

openresty -V
nginx version: openresty/1.11.2.5
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC)
built with OpenSSL 1.0.2k 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/local/openresty/nginx --with-cc-opt='-O2 -I/usr/local/openresty/zlib/include -I/usr/local/openresty/pcre/include -I/usr/local/openresty/openssl/include' --add-module=../ngx_devel_kit-0.3.0 --add-module=../echo-nginx-module-0.61 --add-module=../xss-nginx-module-0.05 --add-module=../ngx_coolkit-0.2rc3 --add-module=../set-misc-nginx-module-0.31 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.06 --add-module=../srcache-nginx-module-0.31 --add-module=../ngx_lua-0.10.10 --add-module=../ngx_lua_upstream-0.07 --add-module=../headers-more-nginx-module-0.32 --add-module=../array-var-nginx-module-0.05 --add-module=../memc-nginx-module-0.18 --add-module=../redis2-nginx-module-0.14 --add-module=../redis-nginx-module-0.3.7 --with-ld-opt='-Wl,-rpath,/usr/local/openresty/luajit/lib -L/usr/local/openresty/zlib/lib -L/usr/local/openresty/pcre/lib -L/usr/local/openresty/openssl/lib -Wl,-rpath,/usr/local/openresty/zlib/lib:/usr/local/openresty/pcre/lib:/usr/local/openresty/openssl/lib' --with-pcre-jit --with-ipv6 --with-stream --with-stream_ssl_module --with-http_v2_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --with-http_stub_status_module --with-http_realip_module --with-http_addition_module --with-http_auth_request_module --with-http_secure_link_module --with-http_random_index_module --with-http_gzip_static_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-threads --with-file-aio --with-dtrace-probes --with-http_ssl_module

请求:curl 127.0.0.1:8030 -H 'X-Uid:30' -H 'X-Real-IP:192.168.1.1'
报错:

<title>500 Internal Server Error</title>

500 Internal Server Error


openresty

错误日志:
2017/09/13 12:51:56 [error] 19730#19730: *1 lua entry thread aborted: runtime error: ../lib/lua-resty-core/lib/ngx/semaphore.lua:64: /usr/local/openresty/luajit/lib/libluajit-5.1.so.2: undefined symbol: ngx_http_lua_ffi_semaphore_new
stack traceback:
coroutine 0:
[C]: in function 'require'
/opt/ABTestingGateway/utils/../diversion/diversion.lua:11: in function </opt/ABTestingGateway/utils/../diversion/diversion.lua:1>, client: 127.0.0.1, server: api.weibo.cn, request: "GET / HTTP/1.1", host: "127.0.0.1:8030"
2017/09/13 12:58:02 [error] 20445#20445: *1 lua entry thread aborted: runtime error: ../lib/lua-resty-core/lib/ngx/semaphore.lua:64: /usr/local/openresty/luajit/lib/libluajit-5.1.so.2: undefined symbol: ngx_http_lua_ffi_semaphore_new
stack traceback:
coroutine 0:
[C]: in function 'require'
/opt/ABTestingGateway/utils/../diversion/diversion.lua:11: in function </opt/ABTestingGateway/utils/../diversion/diversion.lua:1>, client: 127.0.0.1, server: api.weibo.cn, request: "GET / HTTP/1.1", host: "127.0.0.1:8030"

@sunzhanyi
Copy link

sunzhanyi commented Nov 3, 2017

经过对openresty各版本的比对,我发现api ngx_http_lua_ffi_sema_new的引入是从当前最新版本openresty-1.9.15.1开始的,所以没有发现,看来我的锅轻一点了 :)

解决这个问题的终极办法是,如果想用semaphore的话,每次使用lua-resty-core的时候,需要将lua-resty-core/lib/ngx 和 lua-resty-core/lib/resty 的版本与openresty保持一直,简单粗暴的方法就是,从/usr/local/oprensty/lualib中将ngx和resty目录 copy 到ABTestingGateway的lib/lua-resty-core目录下替换;

解决这个问题的终极办法是,如果想用semaphore的话,每次使用lua-resty-core的时候,需要将lua-resty-core/lib/ngx 和 lua-resty-core/lib/resty 的版本与openresty保持一直,简单粗暴的方法就是,从/usr/local/oprensty/lualib中将ngx和resty目录 copy 到ABTestingGateway的lib/lua-resty-core目录下替换;

我之所以没有将lua_package_path中的路径直接指定到openresty的路径下,原因是1、我们使用的tengine,所以lua-resty-core等lib需要从目录外指定;2、运维人员应该拥有自己指定lib路径的权力。

这样的话,我仍然将本repo中的lib-resty-core保持原状,然后在readme中说明吧。

@sleevefone
Copy link

有相关的微信群吗,方便大家学习交流,谢谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants