春哥,你好!
我们在线上环境使用了lua-resty-core中shdict.lua的get方法会出现coredump,一天一两个,无法复现
想请教看看如何更详细定位和解决
出coredump增加代码:
init_worker_by_lua_block {
require("resty.core.shdict")
}
shdict.lua 删除掉除了get以外的方法
if ngx_shared then
local _, dict = next(ngx_shared, nil)
if dict then
local mt = getmetatable(dict)
if mt then
mt = mt.__index
if mt then
mt.get = shdict_get
end
end
end
end
----------------------------------------------------------------------
线上版本使用
nginx : 1.15.6
lua-nginx-module: 10014 git commit:c65f5738a21b57678dee18d2fcfed482e6a4681b
lua-resty-core: 0.1.16 git commit:e9a92da114a736b6ae90d7f8eb99ae6d925873c7
luajit: openresty的luajit v2.1-20181029 git commit:c58fe79b870f1934479bf14fe8035fc3d9fdfde2
-----------------------------------------------------------------------------
coredump的堆栈
看着是luajit gc回收问题,试过官方的luajit一样会出现coredump
(gdb) bt
#0 0x00000000005c9b3d in gc_marktrace (g=0x4128c3c0, T=0x416d3398) at lj_gc.c:230
#1 gc_traverse_trace (g=0x4128c3c0, T=0x416d3398) at lj_gc.c:251
#2 0x00000000005ca19c in propagatemark (g=0x4128c3c0) at lj_gc.c:340
#3 0x00000000005caa48 in lj_gc_step (L=0x4022cc00) at lj_gc.c:689
#4 0x00000000005c9024 in lj_fff_gcstep ()
#5 0x000000000051130c in ngx_http_lua_run_thread (L=0x4128c378, r=0x7fd5a5006050, ctx=0x7fd5a50013e0, nrets=0) at addons/lua-nginx-module/src/ngx_http_lua_util.c:1073
#6 0x0000000000515a24 in ngx_http_lua_access_by_chunk (L=0x4128c378, r=0x7fd5a5006050) at addons/lua-nginx-module/src/ngx_http_lua_accessby.c:338
#7 0x0000000000515f7e in ngx_http_lua_access_handler (r=0x7fd5a5006050) at addons/lua-nginx-module/src/ngx_http_lua_accessby.c:163
#8 0x0000000000466a15 in ngx_http_core_access_phase (r=0x7fd5a5006050, ph=0x7fd5140dbd58) at src/http/ngx_http_core_module.c:1216
#9 0x00000000004631fd in ngx_http_core_run_phases (r=0x7fd5a5006050) at src/http/ngx_http_core_module.c:991
#10 0x0000000000470568 in ngx_http_process_request_headers (rev=<value optimized out>) at src/http/ngx_http_request.c:1428
#11 0x0000000000470b84 in ngx_http_process_request_line (rev=0x7fd57c26cba0) at src/http/ngx_http_request.c:1099
#12 0x00000000004551f1 in ngx_epoll_process_events (cycle=0x7fd5a56af4d0, timer=<value optimized out>, flags=<value optimized out>)
at src/event/modules/ngx_epoll_module.c:902
#13 0x0000000000448cd5 in ngx_process_events_and_timers (cycle=0x7fd5a56af4d0) at src/event/ngx_event.c:327
#14 0x0000000000452705 in ngx_worker_process_cycle (cycle=0x7fd5a56af4d0, data="" optimized out>) at src/os/unix/ngx_process_cycle.c:832
#15 0x0000000000450840 in ngx_spawn_process (cycle=0x7fd5a56af4d0, proc=0x4526c0 <ngx_worker_process_cycle>, data="" name=0x65f9e5 "worker process", respawn=-4)
at src/os/unix/ngx_process.c:199
#16 0x0000000000451e2c in ngx_start_worker_processes (cycle=0x7fd5a56af4d0, n=8, type=-4) at src/os/unix/ngx_process_cycle.c:411
#17 0x000000000045365e in ngx_master_process_cycle (cycle=0x7fd5a56af4d0) at src/os/unix/ngx_process_cycle.c:287
#18 0x00000000004280b0 in main (argc=<value optimized out>, argv=<value optimized out>) at src/core/nginx.c:415
(gdb) f 0
#0 0x00000000005c9b3d in gc_marktrace (g=0x4128c3c0, T=0x416d3398) at lj_gc.c:230
230 in lj_gc.c