-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Introduce new cronjob to regularly cleanup outdated lock files if fil… #39372
base: 2.4-develop
Are you sure you want to change the base?
Conversation
Hi @hostep. Thank you for your contribution!
Allowed build names are:
You can find more information about the builds here For more details, review the Code Contributions documentation. |
@magento run all tests |
You can archive almost the same by pointing lock directory to system tmp directory |
Thanks @kandy, that sounds like a great idea. However, when checking some of the servers that our projects are hosted on, the files that are kept in So I don't think we can trust the cleanup of |
…e based lock provider is being used.
1f340c1
to
fe3f49b
Compare
@magento run all tests |
@kandy, I reached out to one of the hosting companies we work with on a regular basis and they provide us with servers that at the moment run on Debian 11 or 12. And they told me that Debian only cleans out the So I wouldn't suggest to use |
…e based lock provider is being used.
Description (*)
When Magento is setup to use file based locking, then we need to keep the directory that stores these files under control.
I'm introducing a cronjob here, that runs once per day and searches for lock files that haven't been modified in the last 24 hours and can thus be safely removed. This will keep the contents of the lock files directory under control.
This cronjob will only execute something when the lock provider is configured to use files, not when one of the others is used (database - the default, zookeeper or cache)
Related Pull Requests
Fixed Issues (if relevant)
Manual testing scenarios (*)
var/locks
, expected is that no file should be older then 48 hoursvar/log/system.log
file for the phraseDeleted xxx old lock files
. After 48 hours, it should appear at least once, maybe twice or more, thexxx
should in theory be bigger then 0 at least once.Questions or comments
app/code/Magento
that is related to Locks, I picked theMagento/Backend
one, because it already has a similar cronjob to keep caches cleanIf this isn't a good idea, how should we identify lock files? Maybe an extra check can be added to only delete files that are 0 bytes? And skip files that are bigger?
The existing integration test used
/tmp
, so maybe people use this directory as well in real life and deleting all kinds of random files from that directory might not be a good idea?Contribution checklist (*)