Unable to acquire a lock for caching. Error code: ex_unabletolock

Unable to acquire a lock for caching. Error code: ex_unabletolock

by Larry Elchuck -
Number of replies: 3

I have upgraded about 15 installs of Moodle to 3.9 (latest) from 3.7.latest and this is the only one that is causing me issues.  It is also  the only one on the inmotion hosting service, by the way.  I looked through previous threads and I did delete the localcache and cache folder contents in the data folder. After this is done, it brings up the splash screen  for the upgrade and then the normal settings screen .... before the following warnings and error is generated when I press continue.

I also performed 777 on the data folder, but this yielded no fix either.

Any help is appreciated.

=========

Your cache configuration file is out of date and needs to be refreshed.
  • line 93 of /cache/locallib.php: call to debugging()
  • line 578 of /cache/locallib.php: call to cache_config_writer->config_save()
  • line 505 of /cache/locallib.php: call to cache_config_writer->write_definitions_to_cache()
  • line 448 of /cache/classes/factory.php: call to cache_config_writer::update_definitions()
  • line 218 of /cache/disabledlib.php: call to cache_factory->create_definition()
  • line 254 of /cache/disabledlib.php: call to cache_factory_disabled->create_definition()
  • line 182 of /cache/classes/loaders.php: call to cache_factory_disabled->create_cache_from_definition()
  • line 343 of /lib/dml/moodle_database.php: call to cache::make()
  • line 1113 of /lib/dml/moodle_database.php: call to moodle_database->get_metacache()
  • line 662 of /lib/dml/moodle_database.php: call to moodle_database->get_columns()
  • line 1656 of /lib/dml/moodle_database.php: call to moodle_database->where_clause()
  • line 1490 of /lib/moodlelib.php: call to moodle_database->get_field()
  • line 798 of /lib/setuplib.php: call to get_config()
  • line 652 of /lib/setup.php: call to initialise_cfg()
  • line 39 of /config.php: call to require_once()
  • line 88 of /admin/index.php: call to require()
Unable to acquire a lock for caching.
Debug info: 
Error code: ex_unabletolock
Stack trace: 
  • line 159 of /cache/locks/file/lib.php: cache_exception thrown
  • line 104 of /cache/locallib.php: call to cachelock_file->lock()
  • line 578 of /cache/locallib.php: call to cache_config_writer->config_save()
  • line 505 of /cache/locallib.php: call to cache_config_writer->write_definitions_to_cache()
  • line 448 of /cache/classes/factory.php: call to cache_config_writer::update_definitions()
  • line 218 of /cache/disabledlib.php: call to cache_factory->create_definition()
  • line 254 of /cache/disabledlib.php: call to cache_factory_disabled->create_definition()
  • line 182 of /cache/classes/loaders.php: call to cache_factory_disabled->create_cache_from_definition()
  • line 343 of /lib/dml/moodle_database.php: call to cache::make()
  • line 1113 of /lib/dml/moodle_database.php: call to moodle_database->get_metacache()
  • line 662 of /lib/dml/moodle_database.php: call to moodle_database->get_columns()
  • line 1656 of /lib/dml/moodle_database.php: call to moodle_database->where_clause()
  • line 1490 of /lib/moodlelib.php: call to moodle_database->get_field()
  • line 798 of /lib/setuplib.php: call to get_config()
  • line 652 of /lib/setup.php: call to initialise_cfg()
  • line 39 of /config.php: call to require_once()
  • line 88 of /admin/index.php: call to require()

Average of ratings: -
In reply to Larry Elchuck

Re: Unable to acquire a lock for caching. Error code: ex_unabletolock

by Ken Task -
Picture of Particularly helpful Moodlers

How about removing contents of moodledata/muc/ ?

Also, if one has ssh to the server (would think inmotion does allow) how about using the scripts in code/admin/cli/ to upgrade?

Those can be executed as root if on a system where you have root access.   Ownerships/permissions on files/folds can be checked and changed if needed.

'SoS', Ken



Average of ratings: Useful (1)
In reply to Ken Task

Re: Unable to acquire a lock for caching. Error code: ex_unabletolock

by Larry Elchuck -
Hi Ken.

Thanks for your help.

By renaming (in case I needed it later to review) the config,php file in /muc, I was able to login .... which took me to the splash screen for the update ... followed by the next screen of checks .... then when I clicked on Continue (I think that was the button), the following error occurred:

Fatal error: Illegal length modifier specified 'f' in s[np]printf call in /home/public_html/cc39/cache/locallib.php on line 106

When I googled this error , I found a discussion on Drupal and it turns out that by upgrading the php version to 7.4 , it fixed the issue for the Drupal admin.

I upgraded the PHP version to 7.4 from 7.2 in the shared host and deleted the contents of /cache and /localcache in the data folder again, for good measure.

Next time I logged in as admin, it took me through the upgrade successfully.

I'll need to do this again when I'm ready to move to production, but at least I resolved the issue with your help now and in a previous thread where you mentioned deleting the contents of /cache and /localcache in the data folder.

Cheers
Average of ratings: Useful (1)
In reply to Ken Task

Re: Unable to acquire a lock for caching. Error code: ex_unabletolock

by Thet Shwe Wine -
Dear Ken,

At my website display "Unable to acquire a lock for caching ". How can i do for this? Please instructed to me. I have lack of my experience. I can't enter my site. Thank You,

Regards
Thet Shwe Wine