Closed LinneaHarts closed 6 months ago
I’m not able to reproduce this.
It could be that a previous mutex lock wasn’t released properly, for that single section’s entry.
Are you overriding the mutex
component config from config/app.php
? If so, please post the custom config. Or you could try just removing it entirely, since you’ll generally be better off with Craft’s default mutex config, especially since Craft 4.6.0.
Commenting out my mutex override fixed this. Thank you!
Before you close this, do we still need redis for multi-server sites? I had the code below, with the mutex commented out now, as you said.
use craft\helpers\App;
$cache = [
'class' => yii\redis\Cache::class,
'defaultDuration' => 86400,
'keyPrefix' => App::env('REDIS_KEY_PREFIX'),
];
$enable_replicas = App::env('REDIS_ENABLE_REPLICAS');
if ($enable_replicas && strtolower($enable_replicas) !== 'false') {
$cache['enableReplicas'] = true;
$cache['replicas'] = ['redis'];
$rep_1 = App::env('REDIS_REPLICA_1');
if (strlen($rep_1)) {
array_push($cache['replicas'], ['hostname' => $rep_1]);
}
$rep_2 = App::env('REDIS_REPLICA_2');
if (strlen($rep_2)) {
array_push($cache['replicas'], ['hostname' => $rep_2]);
}
}
return [
'modules' => [
'my-module' => \modules\Module::class,
'protect' => \modules\Protect::class,
'external-cache-busting' => \modules\ExternalCacheBusting::class,
],
'bootstrap' => [
'my-module',
'protect',
'external-cache-busting',
],
'components' => [
'redis' => [
'class' => 'yii\redis\Connection',
'hostname' => App::env('REDIS_HOSTNAME') ?: 'redis',
'port' => App::env('REDIS_PORT') ?: 6379,
'database' => App::env('REDIS_DATABASE') ?: 0,
],
'cache' => $cache,
// 'mutex' => [
// 'class' => 'yii\redis\Mutex',
// ],
],
];
Nope! As of 4.6 it’s fine to use the built-in mutex
driver on multi-server sites :)
What happened?
Description
I was getting a lot of errors of the form Could not acquire a lock to save a revision for element 60 when trying to apply project config. I turned off versioning on all sections and was able to apply proejct config.
Now I'm trying to turn it back on, and every single is giving me this error on its elementId when I try to turn on revisions.
Steps to reproduce
Expected behavior
Versioning can be turned on
Actual behavior
I get an error:
Additional Information
Craft: 4.8.10 (though it was happening for previous versions as well) Plugins:
Craft CMS version
4.8.10
PHP version
8.1
Operating system and version
Mac, Linux
Database type and version
MySQL, Mariadb
Image driver and version
No response
Installed plugins and versions
Admin Bar 4.3.0 Asset Usage 3.3.0 Blitz 4.16.3 CKEditor 3.8.3 CodeMirror 2.0.0 Colorit 4.0.0 Element API 4.1.0 Field Manager 3.0.8 HOMM XML Sitemap 1.0.3 Hyper 1.1.27 Imager X Lite 4.4.0 Inlin Mix 1.7.1 Retcon 2.7.5 Retour 4.1.16 SuperTable 3.0.13