情况是这样的,先看crash时的callstack:2016/10/28 12:15:29 [error] 19540#0: nginx coredump by signal 11 (SIGSEGV)nginx: worker process[0x541d48]/lib64/libpthread.so.0[0x3af640f7e0]nginx: worker process(ngx_http_lua_run_posted_threads+0x5c)[0x566b75]nginx: worker process[0x57c3da]nginx: worker process[0x57c165]
nginx: worker process(ngx_http_lua_content_wev_handler+0x43)[0x5692f3]nginx: worker process[0x577a4d]nginx: worker process[0x577db8]nginx: worker process[0x577006]nginx: worker process(ngx_event_expire_timers+0x125)[0x47c248]nginx: worker process(ngx_process_events_and_timers+0x155)[0x479e4b]nginx: worker process[0x4878d3]nginx: worker process(ngx_spawn_process+0x6bb)[0x4841cf]nginx: worker process[0x48737f]nginx: worker process(ngx_master_process_cycle+0x506)[0x485f9c]nginx: worker process(main+0x53d)[0x44c6b9]/lib64/libc.so.6(__libc_start_main+0xfd)[0x3af601ed1d]nginx: worker process[0x44bf41]addr2line -f 0x57c3da -e nginxngx_http_lua_socket_tcp_resume_helperngx_http_lua_socket_tcp.c:0 addr2line -f 0x566b75 -e nginxngx_http_lua_run_posted_threads??:0我是想在出现502的时候,重新请求一个页面,发给客户端,代码如下:error_page @fallback_502;location @fallback_502 { content_by_lua_block { local http = require "resty.http" local httpc = http.new() httpc:set_timeout(3000) local ngx_var = ngx.var local http_host = ngx_var.http_host local request_method = ngx_var.request_method local request_uri = ngx_var.request_uri local request_body = "" local server_port = ngx_var.server_port local headers = ngx.req.get_headers() .....这里根据上面的一些值,确定request, request_method和headers local res, err = httpc:request_uri(request, { method = request_method, headers = headers }) if not res or res.status == 502 then ngx.exit(502) end ngx.status = res.status ngx.say(res.body) }} 上面这段代码有概率crash,对比测试,下面的代码则没有任何问题。location @fallback_502 { ngx.exit(502)}很纳闷,是哪里用得不对吗?我的环境如下:nginx 1.10.1lua-resty-http(不是春哥开发的): https://github.com/pintsized/lua-resty-httplua-nginx-module v0.10.5请教下大家,这个是什么问题呼叫春哥 --