Problem/Motivation
After upgrading the code from Drupal 10.4 to 11.1, trying to run database updates with Drush or at update.php results in this error:
Error: Call to a member function insert() on null in Drupal\Core\Lock\DatabaseLockBackend->acquire() (line 71 of /var/www/html/web/core/lib/Drupal/Core/Lock/DatabaseLockBackend.php)
Presumably other people are not running into this or it would have been reported already, but all the updates are for Drupal core:
------------ --------------------- --------------- ----------------------------------------------
---
Module Update ID Type Description
------------ --------------------- --------------- ----------------------------------------------
---
system 11001 hook_update_n 11001 - Update length of menu_tree fields url
and route_param_key from 255 to 2048.
system 11100 hook_update_n 11100 - Invalidate container because the modu
le
handler has changed.
system 11102 hook_update_n 11102 - Equivalent update to 10400.
block make_weight_integer post-update Ensures that all block weights are integers.
media media_author_views_ post-update Empty update function to clear the Views data
filter_update cache.
path_alias update_path_alias_r post-update Update the path_alias_revision indices.
evision_indexes
system remove_rss_cdata_su post-update Rebuild the container to fix HTML in RSS feed
s.
bscriber
system sdc_uninstall post-update Uninstall the sdc module if installed.
------------ --------------------- --------------- ----------------------------------------------
---
Error: Call to a member function insert() on null in Drupal\Core\Lock\DatabaseLockBackend->acquire
() (line 71 of /var/www/html/web/core/lib/Drupal/Core/Lock/DatabaseLockBackend.php).
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Comments
Comment #2
mlncn commentedIt is quite bizarre because the errors are for not finding the database connection, but elsewhere in Drupal, outside the DatabaseLockBackend, it certainly has no trouble accessing the database. I can even get it to run the updates simply by putting an
if ($this->database) {check in there; the pre-existing code to go back for another try works fine it seems, but the exception i am getting is not one that was expected.The same sort of error (query on NULL database) happens in this block, but running the database updates a second time works; clearly it is able to get the database sometimes. [EDIT: Or not so clearly, i think the error still happened after successfully running database updates.]
Comment #3
cilefen commentedGot a stack trace?
Comment #4
elkaro commentedComment #5
catchLet's assume it's a bug for now.
Are you able to create a clean install of Drupal 10.4 and update to Drupal 11 on otherwise the same environment?
Comment #6
mlncn commentedSo it is not a Drupal Core issue (as i guess i should have expected)— it occurs due to the Drupal 11.1-compatible issue fork of Field Encrypt, specifically the src/FieldEncryptServiceProvider.php file, which is… not mentioned in the field_encrypt.services.yml Huh, did not realize there would be anywhere Drupal automatically interprets something not in Plugins or something like that. Anyhow if there is anything that jumps out to core maintainers for Field Encrypt to fix… #3486465: Make Field Encrypt compatible with Drupal 11.1 by removing eval() and adding a ServiceProvider, use OOP hooks
Comment #7
cilefen commented