General error: 1205 Lock wait timeout exceeded; on $user->addRole

Created on 26 August 2024, 8 months ago

Problem/Motivation

When in hook_modules_installed the function $user->save() is used (on module install) it raises an error on the database-server

Unable to decode output into JSON: Syntax error

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction:
INSERT INTO "cache_config" ("cid", "expire", "created", "tags", "checksum", "data", "serialized") VALUES (:db_insert_placeholder_0, :db_inse
rt_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeho
lder_6) ON DUPLICATE KEY UPDATE "cid" = VALUES("cid"), "expire" = VALUES("expire"), "created" = VALUES("created"), "tags" = VALUES("tags"),
"checksum" = VALUES("checksum"), "data" = VALUES("data"), "serialized" = VALUES("serialized"); Array
(
[:db_insert_placeholder_0] => last_write_timestamp_cache_config
[:db_insert_placeholder_1] => -1
[:db_insert_placeholder_2] => 1724654985.414
[:db_insert_placeholder_3] =>
[:db_insert_placeholder_4] => 0
[:db_insert_placeholder_5] => d:1724654985.415;
[:db_insert_placeholder_6] => 1
)
in Drupal\Core\Cache\DatabaseBackend->doSetMultiple() (line 312 of /var/www/clients/client1/web12/web/drupal/docroot/core/lib/Drupal/Core/C
ache/DatabaseBackend.php).

Steps to reproduce

Use function $user->save() in hook_modules_installed or hook_install()

Proposed resolution

After investigation the $user->save() function seems to flood the cache-config table

Remaining tasks

User interface changes

🐛 Bug report
Status

Active

Version

10.3

Component
Cache 

Last updated 2 days ago

Created by

🇳🇱Netherlands ckspringbok

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024