-
-
Notifications
You must be signed in to change notification settings - Fork 816
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
lock failed after every xmake command #992
Comments
After version 2.3.1, I added a file lock to ensure that only one xmake process is compiling the current project at the same time. You can check if there are other xmake processes compiling the current project. |
If I understand it correctly, there is no other xmake process compiling the current project simultaneously. However, I doubt cause comes from sharing |
It works fine for me. Please try to update to the dev branch code first to confirm if the same problem exists. If you still have the same problem, you can run the following command to get project file lock path. xmake l core.project.project.filelock
filelock "/Users/ruki/projects/personal/xmake/tests/projects/c/console/.xmake/macosx/x86_64/project.lock" Then use lsof to see which processes are accessing it when compiling. $ lsof .xmake/macosx/x86_64/project.lock
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
xmake 14004 ruki 7r REG 1,4 0 61847353 .xmake/macosx/x86_64/project.lock
ccache 14660 ruki 7r REG 1,4 0 61847353 .xmake/macosx/x86_64/project.lock
ccache 14663 ruki 7r REG 1,4 0 61847353 .xmake/macosx/x86_64/project.lock
clang 14680 ruki 7r REG 1,4 0 61847353 .xmake/macosx/x86_64/project.lock
clang 14681 ruki 7r REG 1,4 0 61847353 .xmake/macosx/x86_64/project.lock
clang 14685 ruki 7r REG 1,4 0 61847353 .xmake/macosx/x86_64/project.lock Of course, there may be other problems that cause lock fail, such as permission issues. |
In addition, you can try to create an empty project to compile and confirm whether you have the same problem. xmake create test
cd test
xmake |
I've try the suggestions above. Lock failed error throws the same even on |
I added more debug info on test branch. Can you update to test branch and let me see the output? |
Unfortunately, seems like I am not able to access the test branch from
Should I clone the git repo and build from source? Cause I install my xmake through deb file. |
I have pushed test branch to other git mirrors. You can try it again. |
Sorry it still throws the same error.
|
Very strange, you can leave project directory and run |
Here's the diagnosis info
Anyway I remove the existing xmake with
It throws the same error again after
|
can you try |
It works! I successfully download the test branch and I do the same thing.
I guess it finally logs some information you need. Hope this helps. |
Ok, I will look at it. |
I added more debug log, can you try run
Because I failed to push the test branch to gitlab yesterday. It should work now, you can try again. |
Here's the output this time, please check.
Btw, I remove the whole test_proj for making sure it is not affected by previous version. Is that necessary or maybe I just make things messier, since I find out the address of file lock is different this time? |
It doesn't matter. What is your Linux distribution and architecture? Very strange. Looking at the log, the file lock has been created and opened normally, and the fd is also correct, but it still reports: Bad file descriptor |
The distribution info is as following.
And my architecture is x86_64. |
Every time the xmake command is executed normally, try manually deleting the lock file? xmake -vD
rm .xmake/linux/x86_64/project.lock
xmake clean -vD I don’t have ubuntu18.04, but it works fine on my ubuntu16.04 |
It works totally fine if I explicitly remove the |
In theory, the file lock will be automatically released when the xmake process exits, and it will not affect the next operation. I will update the code later to further confirm the reason. |
Anyway, thanks for helping and I will stay in removing it manually temporarily. Please let me know if need any further information. |
I try to close the filelock when the process exits, you can try it again. |
Sorry I tried and it is still not working.
Looks like the file is closed successfully. But if the file accidentally remain unclosed, shouldn't we know from |
Yes, linux will automatically close filelock after the program exits, but the problem is that on your system, you must delete the previous project.lock every time to work properly. Why is this happening, I am not very clear. |
I attempt to improve it, you can try it again. |
It works perfectly. Could you give me some detail about the root cause and how you solve it? |
I modified the open mode of filelock. core/src/xmake/io/filelock_open.c tb_long_t tryn = 2;
tb_filelock_ref_t lock = tb_null;
while (!lock && tryn-- > 0)
- lock = tb_filelock_init_from_path2(path, tb_file_info(path, tb_null)? TB_FILE_MODE_RO : TB_FILE_MODE_RW | TB_FILE_MODE_CREAT);
+ lock = tb_filelock_init_from_path2(path, tb_file_info(path, tb_null)? TB_FILE_MODE_RW : TB_FILE_MODE_RW | TB_FILE_MODE_CREAT);
if (lock) xm_lua_pushpointer(lua, (tb_pointer_t)lock);
else lua_pushnil(lua); |
I have updated to the dev branch. |
Thank you very much and hope my issue will make the awesome project like xmake even better. |
I have also encountered this issue, and I found that it is because I do not have permission to create files in the current directory. Just chown to your user. |
Every time when I enter a xmake command such as
xmake build xxx
,xmake clean
...., xmake seems to forbid me to conduct next command. It always raise an error as following.Also I've tried to run diagnosis and here is the output.
I really don't know what's the meaning of "accessed by other processes", since there is no process reading any relevant files and I can't find any information relates to this error in document.
Btw, the error appears when I upgrade to the latest version. It works perfectly in v2.3.1.
The text was updated successfully, but these errors were encountered: