-
Notifications
You must be signed in to change notification settings - Fork 162
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
Race condition when starting up several instances of tilda #502
Comments
I agree that this can be annoying, the locking code is very old and has not been refactored in a long time. It seems the last bigger change of the locking mechanism was (as you mentioned as part of #82) and we introduced flock in commit 0a66b99. There is certainly more potential to clean it up. There are even still Our basic approach is to create a file named So what could be the problem. The locking code that produces the atomic section is here: https://github.com/lanoxx/tilda/blob/master/src/tilda-lock-files.c#L61, one problem that I see is that we do not check the return value of There might be other problems (such as #480). If we keep flock, then one thing we should definitely do is check the return values of However, I played a bit with it and using the following snippet I can reproduce the issue in some occasions: (for i in $(seq 0 10); do src/tilda --version & src/tilda --version & src/tilda --version & src/tilda --version; echo "DONE"; echo ""; done; ) | less Now I think the issue is that we are deleting the global lock file after leaving the critical section. This means at a newly starting tilda instance needs to recreate it and will then lock on a file that has a different inode then the original lock file. If there are three tilda process then I believe the following could happen:
A possible fix might be to not delete the I think the original idea was to make this more "clean" and remove the file after the lock is released, to avoid left-over lockfiles when no tilda process is running. Another alternative could be to try and use POSIX semaphores since they do not need files. |
I pushed this commit today: 5ecc561 which should improve the locking situation. |
I observe a kind of race condition even with a single instance. I have tilda run by window manager (fluxbox) only once at startup. Most of times it works fine but rarely (i haven't gathered statistics, subjectively 1 of 100 runs) it picks up |
Are you running tilda 2.0.0? Or the 1.x version? |
Tilda 2.0.0 |
Im running debian testing and tilda 1.5.4-1
I think this is the same as #82
I run 4 instances of tilda when starting up the pc. Every time a different thing happens. Some times it says invalid key, but some other times it my left tilda has the width that the right tilda is supposed to have and viceversa, as if configurations mixed
Just going into the conf and clicking any setting fixes everything
Some times it even starts correctly, but its rare :)
The text was updated successfully, but these errors were encountered: