-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Lock] SemaphoreStore : sem_remove() produces a warning #29952
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
Comments
Ignoring deletion of semaphore is not ideal, as the number of semaphore is limited (see original bug #27356) Note: this error is triggered when a user tries to remove a semaphore acquired (and not (yet) removed) by another user I'm gonna investigate on it |
Thanks for investigate but ours commands are always executed by the same user so acquire and remove are done under the same user and group. |
hmm. I missunderstood your comment I'm not able to reproduce an Could you please provide a reproduct-case? |
I don't know how to build a reproducer except providing you the full command but I doubt it helps you :-/ |
You can still provide us the command so we can test by ourself ;). |
I've been getting similar issues over the last few weeks:
I'm uncertain if it's related, but it's also from a cronjob running a command that uses the
This runs an SFTP script which is slow hence using Lockable so we don't open multiple connections and download files already in progress of being downloaded. It appears the semaphore is eventually released. here's a few other recent errors:
We started having these errors occur on June 8th. We have no records of any software updates at this point, so I don't think the date of the June 8th has any significance for us. It's unclear how we can reproduce these steps. System InfoLock v4.2.0
|
Could you please provide a reproducer ? |
@Simperfit unfortunately not. It appears to be a race condition in that it only happens rarely despite that the scripts in question run every 5 minutes. Over the last 3 weeks I've only had the errors occur less than 5 times, and it appears the system recovers automatically from it. |
Let's close here then. Without being able to reproduce we won't be able to fix it. Anyway, we can reopen once we are able to reproduce it. |
Hello, I found a way to reproduce warnings. It happens on Linux with systemd configuration : RemoveIPC=1 and using a non system user:
You need to start a command with the LockableTrait with a non system user on a Linux server with systemd and RemoveIPC = 1. If the same user logs in and logs out, the semaphores will be removed by systemd(rsync with ssh, or sftp, were able to reproduce, in my case; it must open a session and close it). When the LockableTrait ends, you will get this warning
Because the semaphore was removed. And because the semaphore was removed, any other command could have used it : you have concurrency issues / race conditions ! @elliottpost
Then the web user acquires the semaphore : it does not share the same permissions with the Command starting user. Then the Command ends : it cannot remove the semaphore, because it does not have permissions
You have concurrency issues / race conditions ! @fmata What can be done : nothing in the code, just use a system user or change configuration. This should be warning when using the LockableTrait. Maybe you could add another Trait using the flockStore for users that cannot change this configuration on their server. I hope I am not mistaken, but I was able to reproduce everything. And semaphore being removed was a big issue for postgresql users / some Linux distributions changed the default value for RemoveIPC : you can read more on the internet I used the flockStore to avoid this issue. |
Thanks so much @hsibboni for this well detailled issue. That would explain a lot. Doc PR opened symfony/symfony-docs#13035 |
Symfony version(s) affected: 3.4.20 / PHP 7.2.5
Description
As stated in #27357 (comment), when I use the
LockableTrait
in command :A warning is emitted :
The command is executed by a cronjob under an user and Unix group different of those of webserver.
How to reproduce
Pre-prod and prod are impacted but I don't know how to reproduce exactly.
Possible Solution
As the warning seems to be non-blocking, I suggest to silence the call to
sem_remove()
as done with@sem_acquire()
.Let me know if I can make the PR.
The text was updated successfully, but these errors were encountered: