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

启动时报错!!! #27

Open
niuhp opened this issue May 20, 2016 · 16 comments
Open

启动时报错!!! #27

niuhp opened this issue May 20, 2016 · 16 comments

Comments

@niuhp
Copy link

niuhp commented May 20, 2016

执行tengine-2.1.2/objs/nginx -p pwd -c conf/nginx.conf时报错
nginx: [emerg] unknown directive "set" in /path/to/ABTestingGateway-master/utils/conf/default.conf:22

tengine信息如下

/root/soft/tengine-2.1.2/objs/nginx -V

Tengine version: Tengine/2.1.2 (nginx/1.6.2)
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC)
TLS SNI support enabled
configure arguments: --with-ld-opt=-Wl,-rpath,/usr/local/web/LuaJIT-2.0.1/lib --with-luajit-inc=/usr/local/web/LuaJIT-2.0.1/include/luajit-2.0 --with-luajit-lib=/usr/local/web/LuaJIT-2.0.1/lib --without-http_rewrite_module --add-module=../lua-nginx-module-0.10.4
loaded modules:
ngx_core_module (static)
ngx_errlog_module (static)
ngx_conf_module (static)
ngx_dso_module (static)
ngx_syslog_module (static)
ngx_events_module (static)
ngx_event_core_module (static)
ngx_epoll_module (static)
ngx_procs_module (static)
ngx_proc_core_module (static)
ngx_openssl_module (static)
ngx_http_module (static)
ngx_http_core_module (static)
ngx_http_log_module (static)
ngx_http_upstream_module (static)
ngx_http_static_module (static)
ngx_http_autoindex_module (static)
ngx_http_index_module (static)
ngx_http_auth_basic_module (static)
ngx_http_access_module (static)
ngx_http_limit_conn_module (static)
ngx_http_limit_req_module (static)
ngx_http_geo_module (static)
ngx_http_map_module (static)
ngx_http_split_clients_module (static)
ngx_http_referer_module (static)
ngx_http_ssl_module (static)
ngx_http_proxy_module (static)
ngx_http_fastcgi_module (static)
ngx_http_uwsgi_module (static)
ngx_http_scgi_module (static)
ngx_http_memcached_module (static)
ngx_http_empty_gif_module (static)
ngx_http_browser_module (static)
ngx_http_user_agent_module (static)
ngx_http_upstream_ip_hash_module (static)
ngx_http_upstream_consistent_hash_module (static)
ngx_http_upstream_check_module (static)
ngx_http_upstream_least_conn_module (static)
ngx_http_upstream_keepalive_module (static)
ngx_http_upstream_dynamic_module (static)
ngx_http_stub_status_module (static)
ngx_http_write_filter_module (static)
ngx_http_header_filter_module (static)
ngx_http_chunked_filter_module (static)
ngx_http_range_header_filter_module (static)
ngx_http_gzip_filter_module (static)
ngx_http_postpone_filter_module (static)
ngx_http_ssi_filter_module (static)
ngx_http_charset_filter_module (static)
ngx_http_userid_filter_module (static)
ngx_http_footer_filter_module (static)
ngx_http_trim_filter_module (static)
ngx_http_headers_filter_module (static)
ngx_http_upstream_session_sticky_module (static)
ngx_http_reqstat_module (static)
ngx_http_lua_module (static)
ngx_http_copy_filter_module (static)
ngx_http_range_body_filter_module (static)
ngx_http_not_modified_filter_module (static)

@BG2BKK
Copy link
Contributor

BG2BKK commented May 20, 2016

configure arguments: --with-ld-opt=-Wl,-rpath,/usr/local/web/LuaJIT-2.0.1/lib --with-luajit-inc=/usr/local/web/LuaJIT-2.0.1/include/luajit-2.0 --with-luajit-lib=/usr/local/web/LuaJIT-2.0.1/lib --without-http_rewrite_module --add-module=../lua-nginx-module-0.10.4

因为 --without-http_rewrite_module 了,所以set指令不生效

@BG2BKK
Copy link
Contributor

BG2BKK commented May 23, 2016

这是redis的unix socket
domain的访问接口,如果自动生成的话,一般是redis启动时生成的,如果你不想用的话,可以在配置文件中取消这个配置。

On Mon, May 23, 2016 at 2:33 PM, niuhp notifications@github.com wrote:

访问ab_admin报错了,提示
/tmp/redis.sock failed (2: No such file or directory)
请问这个文件什么时候生成,什么时候使用


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#27 (comment)

黄振栋
bg2bkk@gmail.com
Phone:15010359288
personal site: https://bg2bkk.github.io

@niuhp
Copy link
Author

niuhp commented May 23, 2016

现在就剩这个了,访问8030端口提示ngx_http_lua_ffi_semaphore_new未定义,,
lua entry thread aborted: runtime error: ../lib/lua-resty-core/lib/ngx/semaphore.lua:64: /usr/local/lib/libluajit-5.1.so.2: undefined symbol: ngx_http_lua_ffi_semaphore_new

@BG2BKK
Copy link
Contributor

BG2BKK commented May 23, 2016

请问你的luajit用的是哪个版本的,LuaJIT-2.1可以在openresty软件包中获得

On Mon, May 23, 2016 at 2:54 PM, niuhp notifications@github.com wrote:

现在就剩这个了,访问8030端口提示ngx_http_lua_ffi_semaphore_new未定义,,
lua entry thread aborted: runtime error:
../lib/lua-resty-core/lib/ngx/semaphore.lua:64:
/usr/local/lib/libluajit-5.1.so.2: undefined symbol:
ngx_http_lua_ffi_semaphore_new


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#27 (comment)

@niuhp
Copy link
Author

niuhp commented May 23, 2016

是2.1.0啊

@niuhp
Copy link
Author

niuhp commented May 23, 2016

@BG2BKK
Copy link
Contributor

BG2BKK commented May 23, 2016

没有遇到过你的错误,用openresty软件包中维护的LuaJIT看看呢?
试一下,不行我再想想别的原因

On Mon, May 23, 2016 at 3:28 PM, niuhp notifications@github.com wrote:

http://luajit.org/download.html


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#27 (comment)

@fonlang
Copy link

fonlang commented Jun 19, 2016

@niuhp 访问8030端口提示ngx_http_lua_ffi_semaphore_new未定义
这个解决了吗?我也遇到了。CentOS7下

@BG2BKK
Copy link
Contributor

BG2BKK commented Jun 19, 2016

你好,这个是ngx_lua比较新的版本中带有的 resty.semaphore模块,请确定ngx_lua版本包含该模块

On Sun, Jun 19, 2016 at 2:42 PM, noodles-v6 notifications@github.com
wrote:

@niuhp https://github.com/niuhp
访问8030端口提示ngx_http_lua_ffi_semaphore_new未定义
这个解决了吗?我也遇到了。CentOS7下


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#27 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AA0sgZfQAfy73w2WlzSeKjgS1uSDrNfXks5qNOS9gaJpZM4Ii9Xy
.

@nosun
Copy link

nosun commented Jul 28, 2016

我用的openresty 最新版本, luajit2.1.0beta2, 也是同样的问题

@BG2BKK
Copy link
Contributor

BG2BKK commented Jul 28, 2016

请问是哪个问题?

On Thu, Jul 28, 2016 at 11:03 AM, 郭华伟 notifications@github.com wrote:

我用的openresty 最新版本, luajit2.1.0beta2, 也是同样的问题


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#27 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AA0sgQXMlo0kLREMK_AicdZalNAztJnaks5qaBv3gaJpZM4Ii9Xy
.

@nosun
Copy link

nosun commented Jul 29, 2016

lua entry thread aborted: runtime error: ../lib/lua-resty-core/lib/ngx/semaphore.lua:64: /usr/local/lib/libluajit-5.1.so.2: undefined symbol: ngx_http_lua_ffi_semaphore_new

反复测试了好几遍,始终如此

@BG2BKK
Copy link
Contributor

BG2BKK commented Jul 29, 2016

你好,这个问题是api的更新,曾经也出现过这样的问题中已经解决了,

但是出现这个问题的原因是我版本中的lua-resty-lib没有更新到最新版,仍然使用了ngx_http_lua_ffi_semaphore_new,而新版已经是ngx_http_lua_ffi_sema_new了,这点我很抱歉。之所以一直没有发现,原因是我开发时采用的是tengine+luajit+lua-resty-lib,我当时的ngx_lua版本和lua-resty-lib契合,所以没有报错;当我采用新版openresty时没有进行深入测试,非常抱歉,我正在修复和测试

但是你的问题在于,使用了非openresty维护的luajit版本,openresty维护的LuaJIT是2.1版本以上了,会有与ngx有关的更新,而你是从官方下载的LuaJIT,编译是不会通过的

checking for LuaJIT library in /home/huang/workspace/oss/LuaJIT-2.1.0-beta2/lib and /home/huang/workspace/oss/LuaJIT-2.1.0-beta2/include/luajit-2.1 (specified by the LUAJIT_LIB and LUAJIT_INC env, with -ldl) ... not found
checking for LuaJIT library in /home/huang/workspace/oss/LuaJIT-2.1.0-beta2/lib and /home/huang/workspace/oss/LuaJIT-2.1.0-beta2/include/luajit-2.1 (specified by the LUAJIT_LIB and LUAJIT_INC env) ... not found
        ./configure: error: ngx_http_lua_module requires the Lua or LuaJIT library and LUAJIT_LIB is defined as /home/huang/workspace/oss/LuaJIT-2.1.0-beta2/lib and LUAJIT_INC (path for lua.h) /home/huang/workspace/oss/LuaJIT-2.1.0-beta2/include/luajit-2.1, but we cannot find LuaJIT there.

@BG2BKK
Copy link
Contributor

BG2BKK commented Jul 29, 2016

经过测试,我换用 lua-resty-core的v0.1.6 tag可以正常使用,目前该项目的master分支是v0.1.7rc+了,我不知道如何指定tag作为git项目的sub module,所以我将所需lua-resty-core手动放到我的项目里,然后在README中指明。

非常感谢你的反馈,欢迎使用

@BG2BKK
Copy link
Contributor

BG2BKK commented Jul 29, 2016

经过对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中说明吧。

@ysjgxm
Copy link

ysjgxm commented Nov 6, 2019

运行时日志报错,index变量错误是什么原因呢:
2019/11/06 12:11:17 [error] 1606#1606: *36 lua entry thread aborted: runtime error: /root/ABTestingGateway/utils/../admin/ab_action.lua:16: attempt to index local 'systemConf' (a userdata value)
stack traceback:
coroutine 0:
/root/ABTestingGateway/utils/../admin/ab_action.lua: in main chunk, client: 127.0.0.1, server: localhost, request: "POST /ab_admin?action=policygroup_set HTTP/1.1", host: "127.0.0.1:8080"

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

5 participants