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

在core文件中出现的lauxlib.c: No such file or directory #1278

Closed
Dear-u opened this issue Dec 16, 2020 · 6 comments
Closed

在core文件中出现的lauxlib.c: No such file or directory #1278

Dear-u opened this issue Dec 16, 2020 · 6 comments

Comments

@Dear-u
Copy link

Dear-u commented Dec 16, 2020

调试core文件的堆栈信息如下

Program terminated with signal 11, Segmentation fault.
#0 resizebox (L=0x7f78ea2c3c28, idx=, newsize=4096) at lauxlib.c:477
477 lauxlib.c: No such file or directory.
in lauxlib.c
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.192.el6.x86_64 libgcc-4.4.7-18.el6.x86_64 libstdc++-4.4.7-18.el6.x86_64
(gdb) bt
#0 resizebox (L=0x7f78ea2c3c28, idx=, newsize=4096) at lauxlib.c:477
#1 0x00000000004272a5 in prepbuffsize (B=0x7f7909bf92f0, sz=, boxidx=-2) at lauxlib.c:546
#2 0x0000000000427411 in luaL_addvalue (B=0x7f7909bf92f0) at lauxlib.c:613
#3 0x00007f79059fb120 in TableToString (L=0x7f78ea2c3c28, b=0x7f7909bf92f0, idx=-1, level=0) at src/lua-trace.c:18
#4 value2string (L=0x7f78ea2c3c28, b=0x7f7909bf92f0, idx=-1, level=0) at src/lua-trace.c:86
#5 0x00007f79059fb325 in StackTraceBack (L=0x7f78ea2c3c28) at src/lua-trace.c:161
#6 0x0000000000415c9d in luaD_precall (L=0x7f78ea2c3c28, func=0x7f78ea2da8c0, nresults=1) at ldo.c:503
#7 0x0000000000415d9f in ccall (L=0x7f78ea2c3c28, func=, nResults=, inc=65537) at ldo.c:546
#8 0x0000000000413d5d in luaG_errormsg (L=0x7f78ea2c3c28) at ldebug.c:761
#9 0x0000000000413ebf in luaG_runerror (L=0x7f78ea2c3c28, fmt=) at ldebug.c:777
#10 0x00000000004144cc in luaG_typeerror (L=0x7f78ea2c3c28, o=0x7f78ea2da850, op=0x4b5aec "perform arithmetic on") at ldebug.c:696
#11 0x00000000004144f3 in luaG_opinterror (L=0x7f78ea2c3c28, p1=0x0, p2=0xfffffffe, msg=0x1000 <Address 0x1000 out of bounds>) at ldebug.c:716
#12 0x0000000000420896 in luaT_trybinTM (L=0x7f78ea2c3c28, p1=0x7f78ea2da850, p2=0x7f78f580d3b0, res=, event=TM_DIV) at ltm.c:161
#13 0x000000000042447f in luaV_execute (L=, ci=) at lvm.c:1485
#14 0x0000000000415db5 in ccall (L=0x7f78ea2c3c28, func=, nResults=, inc=1) at ldo.c:548
#15 0x0000000000412525 in lua_pcallk (L=0x7f78ea2c3c28, nargs=, nresults=-1, errfunc=, ctx=,
k=) at lapi.c:1045
#16 0x000000000042b80f in luaB_xpcall (L=0x7f78ea2c3c28) at lbaselib.c:472
#17 0x0000000000415c9d in luaD_precall (L=0x7f78ea2c3c28, func=0x7f78ea2da120, nresults=2) at ldo.c:503
#18 0x0000000000423c68 in luaV_execute (L=, ci=) at lvm.c:1617
#19 0x0000000000415a03 in unroll (L=0x7f78ea2c3c28, ud=) at ldo.c:613
#20 0x0000000000414df9 in luaD_rawrunprotected (L=0x7f78ea2c3c28, f=0x415df0 , ud=0x7f7909bf9e0c) at ldo.c:147
#21 0x0000000000416144 in lua_resume (L=0x7f78ea2c3c28, from=, nargs=4, nresults=0x7f7909bf9e8c) at ldo.c:716
#22 0x00007f792e5fc44a in lua_resumeX (L=0x7f7904256308, co_index=1, n=) at service-src/service_snlua.c:90
#23 auxresume (L=0x7f7904256308, co_index=1, n=) at service-src/service_snlua.c:146
#24 timing_resume (L=0x7f7904256308, co_index=1, n=) at service-src/service_snlua.c:198
#25 0x00007f792e5fc740 in luaB_coresume (L=0x7f7904256308) at service-src/service_snlua.c:217
#26 0x0000000000415c9d in luaD_precall (L=0x7f7904256308, func=0x7f78f322d1e0, nresults=-1) at ldo.c:503
#27 0x0000000000423d5b in luaV_execute (L=, ci=) at lvm.c:1649
#28 0x0000000000415db5 in ccall (L=0x7f7904256308, func=, nResults=, inc=65537) at ldo.c:548
#29 0x0000000000414df9 in luaD_rawrunprotected (L=0x7f7904256308, f=0x412560 <f_call>, ud=0x7f7909bfa1d0) at ldo.c:147
#30 0x0000000000415f4f in luaD_pcall (L=0x7f7904256308, func=, u=, old_top=192, ef=) at ldo.c:784
#31 0x0000000000412479 in lua_pcallk (L=0x7f7904256308, nargs=, nresults=-1, errfunc=, ctx=,
k=) at lapi.c:1033
#32 0x000000000042b8f0 in luaB_pcall (L=0x7f7904256308) at lbaselib.c:455
#33 0x0000000000415c9d in luaD_precall (L=0x7f7904256308, func=0x7f78f322d0a0, nresults=2) at ldo.c:503
#34 0x0000000000423c68 in luaV_execute (L=, ci=) at lvm.c:1617
#35 0x0000000000415db5 in ccall (L=0x7f7904256308, func=, nResults=, inc=65537) at ldo.c:548
#36 0x0000000000414df9 in luaD_rawrunprotected (L=0x7f7904256308, f=0x412560 <f_call>, ud=0x7f7909bfa4f0) at ldo.c:147
#37 0x0000000000415f4f in luaD_pcall (L=0x7f7904256308, func=, u=, old_top=48, ef=) at ldo.c:784
#38 0x0000000000412479 in lua_pcallk (L=0x7f7904256308, nargs=, nresults=0, errfunc=, ctx=,
k=) at lapi.c:1033
#39 0x00007f79057e2103 in _cb (context=0x7f791e5dcf80, ud=0x7f7904256308, type=1, session=75466, source=0, msg=0x0, sz=0) at lualib-src/lua-skynet.c:75
#40 0x0000000000409d2d in dispatch_message (ctx=0x7f791e5dcf80, msg=0x7f7909bfa5d0) at skynet-src/skynet_server.c:274


按照堆栈调用结果应该是分配内存失败了,但是为什么会有 477 lauxlib.c: No such file or directory 这种错误提示呢?
希望大佬能解释一下

@hanxi
Copy link
Contributor

hanxi commented Dec 16, 2020

首先建议学一下 markdown 语法, 477 lauxlib.c: No such file or directory 是 gdb 找不到 lauxlib.c 源代码文件。 报错在 lauxlib.c 的 477 行。

@hanxi
Copy link
Contributor

hanxi commented Dec 17, 2020

顺便推荐一个工具给你调试吧,可以用来查看 Lua 函数堆栈。 https://github.com/xjdrew/lua-gdb

@Dear-u
Copy link
Author

Dear-u commented Dec 18, 2020

顺便推荐一个工具给你调试吧,可以用来查看 Lua 函数堆栈。 https://github.com/xjdrew/lua-gdb

谢谢,工具中有几个问题已经反馈到issues里了

@Dear-u
Copy link
Author

Dear-u commented Dec 18, 2020

今天查了下这个dump,发现了一个问题有点想不明白,代码文件如下

代码文件
  1 
  2 return function(args, src, tag, scfg)
  3     local condition_id = args[1]
  4     local obj = args[2] == 0 and src or tag
  5     local judge = args[3]
  6     local hp_percent = args[4] / 1000
  7     
  8     ... -- other code here.
  9     
 10 end 

在第6行代码,如果args[4]不存在,会导致进程宕掉,也就是前面贴出的dump堆栈
在lua中难道不是输出错误堆栈信息?!
不知道大佬们有没有遇到过?求解答

@cloudfreexiao
Copy link
Contributor

cloudfreexiao commented Dec 18, 2020

不存在 是 啥意思 ? nil ?
我猜测 你是 有啥 c 库 把 内存 写坏了
参考 下 #1106

@Dear-u
Copy link
Author

Dear-u commented Dec 24, 2020

是三方插进导致的

@Dear-u Dear-u closed this as completed Dec 24, 2020
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