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

plugin.compile_commands.autoupdate 报错 #5337

Open
TOMO-CAT opened this issue Jul 12, 2024 · 17 comments
Open

plugin.compile_commands.autoupdate 报错 #5337

TOMO-CAT opened this issue Jul 12, 2024 · 17 comments
Labels

Comments

@TOMO-CAT
Copy link

Xmake 版本

dev latest

操作系统版本和架构

Linux 720ce3a659a2 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

描述问题

如下图所述,编译准备生成 compile commands 的时候报错:
image
虽然报错信息是 no such file or directory,但实际表现是卡死,直到 jenkins 超时后退出。

期待的结果

修复这个插件的 bug。

工程配置

附加信息和错误日志

@TOMO-CAT TOMO-CAT added the bug label Jul 12, 2024
@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Title: plugin.compile_commands.autoupdate error report

@TOMO-CAT
Copy link
Author

虽然我已经通过配置环境变量 disable 这个插件了,但是还是希望能解决这个 bug。

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Although I have disabled this plug-in by configuring environment variables, I still hope to solve this bug.

@waruqi
Copy link
Member

waruqi commented Jul 13, 2024

先确认下 有没有多个进程并发编译同一个项目目录。。并确认访问权限。

@TOMO-CAT
Copy link
Author

先确认下 有没有多个进程并发编译同一个项目目录。。并确认访问权限。

这个肯定没有,这只有这台机器而且是串行的,先 clone 再 build 的,这个文件是在 build 下的,这问题过去的一个月出现的是第二次,以我们的编译量级来说属于发生概率比较低的。

看上去更像是多个 target 之间并发的,由于我们中间有很多 object target,我估计其他人用 xmake 没我们这么多 target(一个项目大概上百个 target,多的话能到 300 个),所以我们发现了这个问题?

@waruqi
Copy link
Member

waruqi commented Jul 13, 2024

跟 target 并发没关系。这个 rule 的粒度是 project 级的,每次 build 只会全局执行一次,不会每个 target 都去执行,不存在并发问题。。

我这也没法复现,这个只能你这边加点 log 自己调下

local lockfile = io.openlock(tmpfile .. ".lock")

或者调下 c 层实现。。

https://github.com/xmake-io/xmake/blob/dev/core/src/xmake/io/filelock_open.c

@TOMO-CAT
Copy link
Author

after build 不会每个 target 都触发的吗?
image

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


First check whether there are multiple processes compiling the same project directory concurrently. . and confirm access rights.

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


First confirm whether there are multiple processes compiling the same project directory concurrently. . and confirm access rights.

This is definitely not the case. This is only this machine and it is serial. It is cloned first and then built. This file is under build. This is the second time this problem has appeared in the past month. In terms of our compilation level The probability of occurrence is relatively low.

It looks more like concurrency between multiple targets. Since there are many object targets among us, I guess other people using xmake don’t have as many targets as we do (a project has about hundreds of targets, and more can reach 300), so Did we find the issue?

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


It has nothing to do with target concurrency. The granularity of this rule is at the project level. Each build will only be executed globally once, not for each target, so there is no concurrency problem. .

I can't reproduce this. You can only add some logs here and adjust it yourself.

local lockfile = io.openlock(tmpfile .. ".lock")

Or adjust the c layer implementation. .

https://github.com/xmake-io/xmake/blob/dev/core/src/xmake/io/filelock_open.c

@waruqi
Copy link
Member

waruqi commented Jul 13, 2024

看前面 有个 set_kind("project") 配置,仅仅在 build 所有 targets 之后,触发一次,跟 target 没任何关系

_do_project_rules("build_after")

@TOMO-CAT
Copy link
Author

那 open_lock 报错文件不存在是啥意思,48 行不是准备加文件锁吗?之前已经创建过了吗?
image

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


What does it mean when open_lock reports an error that the file does not exist? Isn’t line 48 planning to add a file lock? Have you created it before?
image

@waruqi
Copy link
Member

waruqi commented Jul 13, 2024

正常情况 io.openlock 会自动创建文件,除非遇到文件没权限写。。当然也有其他未知情况,这就要你这自己调 c 代码看 error 具体分析了。。我没法复现,也猜不出来

@TOMO-CAT
Copy link
Author

正常情况 io.openlock 会自动创建文件,除非遇到文件没权限写。。当然也有其他未知情况,这就要你这自己调 c 代码看 error 具体分析了。。我没法复现,也猜不出来

行,下次复现的话我上机器上看看

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Under normal circumstances, io.openlock will automatically create a file unless it encounters a file that does not have permission to write. . Of course, there are other unknown situations, which requires you to adjust the C code yourself and see the detailed analysis of the error. . I can't reproduce it, and I can't guess it either.

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Normally, io.openlock will automatically create a file unless it encounters a file that does not have permission to write. . Of course, there are other unknown situations, which requires you to adjust the C code yourself and see the detailed analysis of the error. . I can't reproduce it, and I can't guess it either.

OK, if it happens again next time, I'll check it out on the machine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants