Unable to get cron lock

Unable to get cron lock

by Amanda Doughty -
Number of replies: 7
Picture of Core developers Picture of Plugin developers

Does anybody have a quickfix for removing a file cron lock? Our cron has not run since Tues because it is unable to get the cron lock.

All of the files in moodledata/lock are empty. The directory permission is set to 777.

We are about to remount the NFS as there were network changes on Tuesday. Anything else we can try?


Average of ratings: -
In reply to Amanda Doughty

Re: Unable to get cron lock

by Andrew Lyons -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Another alternative would be switch to using the DB locking mechanism. The DB is the default locking location so unless you've already actively changed, you may just be looking in the wrong place.

Note: Locking over NFS is generally inadvisable.

Average of ratings: Useful (1)
In reply to Andrew Lyons

Re: Unable to get cron lock

by Tomasz Muras -
Picture of Core developers Picture of Plugin developers Picture of Plugins guardians Picture of Translators

I agree - locking files over NFS should not be used. My understanding is that it's either not supported or it will have a condition race - depending on the version of NFS one is using.

How do you actually switch locking mechanism? See the Moodle demo for example - login as admin and go to https://demo.moodle.net/cache/admin.php . There is only one option available under "Summary of cache lock instances" - and that is file locking.

Average of ratings: Useful (1)
In reply to Andrew Lyons

Re: Unable to get cron lock

by Amanda Doughty -
Picture of Core developers Picture of Plugin developers

WE are using MySQL so our default is file locking I believe. But I will pass on your advice to the server team. Thanks Andrew.

In reply to Amanda Doughty

Re: Unable to get cron lock

by Tomasz Muras -
Picture of Core developers Picture of Plugin developers Picture of Plugins guardians Picture of Translators

If you use postgresql, then your locks will be in the DB.

If you use any other DB, then in the filesystem - under <moodledata>/lock. In this case, you can delete everything under <moodledata>/lock and run cron. If new (empty) files and directories are not created, then your PHP process run from cron can not write there, for some reason. Restarting NFS may help.


Tomek

Average of ratings: Useful (1)
In reply to Tomasz Muras

Re: Unable to get cron lock

by RAILITY RAILI -

All of the files in moodledata/lock are empty. The directory permission is set to 777.

We are about to remount the NFS as there were network changes on Tuesday. Anything else we can try?