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
includes("**/xmake.lua") 卡死 #5052
Comments
估计是 includes 匹配的里面,又匹配到了带有 xmake/xmake/core/base/interpreter.lua Line 1688 in 57a6b50
|
It is estimated that in the includes match, xmake.lua with xmake/xmake/core/base/interpreter.lua Line 1688 in 57a6b50
|
ok,我打日志看看 |
OK, I'll check the logs |
解决了么 |
Is it solved? |
如果到此为止参数都是正确的,那我就重装 xmake 吧,如果参数有问题,那我就接着调试看一下哪一行出的问题 |
If the parameters are correct so far, then I will reinstall xmake. If there is a problem with the parameters, then I will continue debugging to see which line is the problem. |
那你这个估计是走 你可以设置 callback 看下具体遍历到了哪里。。 local file = os.match("**/xmake.lua", true, function (filepath, isdir)
print(filepath)
return true
end) 也可能是你 .git 目录下子文件太多 |
那你只能继续调下 c 里面的遍历了。。 xmake/core/src/xmake/os/find.c Line 36 in f66ae55
拉下 xmake 源码,然后上面地方 通过 printf 或者 tb_trace_i 去 打印下 内部执行,看看遍历到哪了 ./configure
make
source ~/scripts/srcenv.profile
xmake build 再不行,就只能调下 tbox 里面的遍历接口了。。https://github.com/tboox/tbox/blob/c6b0a56076941b8263e162c7fe7b0870ea44e09c/src/tbox/platform/posix/directory.c#L270 |
好的,我再试试,另外这个能通过 includes("/xmake.lua|.git//xmake.lua") 来跳过 .git 下面的遍历吗 |
|
没压测过,但也许会很慢,通常我不会 includes 里面这么干。。 |
你可以自己 |
但应该也不会太慢,顶多比 find 慢一点点而已,这边 llvm 12w 的文件,find 遍历 2s 。 xmake 里面遍历,算上 lua 模式匹配 + print 回显一些耗时,总共也就 10s 。。你这才 4w,按理顶多 4s 的时间。。。卡住肯定是其他问题,这个就只能你自己调 llvm ruki$ time find ./ -type f | wc -l
126189
real 0m1.946s
user 0m0.145s
sys 0m1.629s llvm ruki$ time xmake l os.files "**" > /tmp/a
real 0m10.200s
user 0m4.564s
sys 0m5.304s |
我感觉也是哪里卡死了,打日志调试一下下面的 C 代码看看 |
Then you can only continue to adjust the traversal in c. . xmake/core/src/xmake/os/find.c Line 36 in f66ae55
Pull down the xmake source code, and then use printf or tb_trace_i to print the internal execution to see where it has been traversed. ./configure
make
source ~/scripts/srcenv.profile
xmake build If that doesn't work, you can only adjust the traversal interface in tbox. . https://github.com/tboox/tbox/blob/c6b0a56076941b8263e162c7fe7b0870ea44e09c/src/tbox/platform/posix/directory.c#L270 |
Okay, I'll try again. Can I use includes("/xmake.lua|.git//xmake.lua") to skip the traversal under .git? |
|
I haven't tested the pressure, but it may be very slow. Usually I don't do this in includes. . |
You can test it yourself with |
find is pure C. Every traversal in xmake requires internal scheduling of Lua interface interaction, and Lua pattern matching has to be done every time. It will affect the performance to some extent, but it cannot be avoided. Moreover, the traversal results have to be stuffed into Lua table, which is limited. Resource management in lua |
But it shouldn’t be too slow, at most a little slower than find. For the llvm 12w file here, find traverses 2s. The traversal in xmake, including lua pattern matching + print echo, takes some time, and the total time is only 10s. . You are only 4w, so it should take you 4s at most. . . If it gets stuck, it must be due to other problems. You can only adjust this yourself. llvm ruki$ time find ./ -type f | wc -l
126189
real 0m1.946s
user 0m0.145s
sys 0m1.629s llvm ruki$ time xmake l os.files "**" > /tmp/a
real 0m10.200s
user 0m4.564s
sys 0m5.304s |
I feel like it's stuck somewhere. Let's log and debug the C code below. |
而且按你目前的 xmake.lua 结构,可以改成 |
And according to your current xmake.lua structure, you can change it to |
Xmake 版本
xmake v2.8.9+dev.50dbca648
操作系统版本和架构
Ubuntu 2204
描述问题
一旦使用 includes("/xmake.lua") 就会导致卡死,但是逐个逐个使用就没有问题。
我一开始怀疑是有 xmake.lua 文件也用了 includes("/xmake.lua") 导致循环解析,所以将当前文件夹下所有的 xmake.lua 挨个添加排查:
因为另一台电脑也是用的这个 xmake commit-id 的版本,所以也排除是 xmake 版本的问题。如果可以调试的话应该是很容易发现问题的,但是 emmylua 插件也是在 xmake 进程内运行的,还没走到调试阶段就卡住了:
期待的结果
想知道卡死的原因,怀疑和本地项目有关系,但是项目太大不方便构造一个最小 demo。或者有没有其他的调试方法。
工程配置
暂无
附加信息和错误日志
无。
The text was updated successfully, but these errors were encountered: