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

Created on 26 August 2024, 24 days 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. But still the results are fine. (roles are added to the user).

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

Postponed: needs info

Version

10.3 ✨

Component
CacheΒ  β†’

Last updated about 11 hours ago

Created by

πŸ‡³πŸ‡±Netherlands ckspringbok

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024