Closed (fixed)
Project:
Honeypot
Version:
2.1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
7 May 2022 at 23:07 UTC
Updated:
6 Jun 2022 at 04:19 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
xmacinfoError message before forcing a cache rebuild
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException : You have requested a non-existent service "honeypot". dans Drupal\Component\DependencyInjection\Container->get() (ligne 156 de /home/sitename/public_html/web/core/lib/Drupal/Component/DependencyInjection/Container.php).Comment #3
tr commentedDid you run update.php?
Comment #4
hassebasse commentedI also had problems and what solved it was
drush cache-rebuild. Update PHP didn't make any difference, so it was not a DB issue.Thank you xmacinfo
Comment #5
tr commentedThe 'honeypot' service is new in the 2.1.x branch, so the
ServiceNotFoundExceptionis expected if you don't rebuild the service container. When the service container is rebuilt then Drupal will know about the new service.update.phprebuilds the service container.drush cralso rebuilds the service container.When you
composer updatea module, you must always runupdate.php. This is well documented. This is not something that a contributed module like Honeypot is responsible for. If you don't runupdate.php, then having ahook_update_N()to clear the cache isn't going to do anything because that hook will never be run either.Note that introducing a service in a minor-point release and deprecating the procedural functions is an extremely common change in Drupal core, and never requires a
hook_update_N()to rebuild the cache.Comment #6
xmacinfo@TR
Please note that each time I update a module, I run update.php.
The bug here is that AFTER running update.php, the site still emits a 500 error.
Watchdog output:
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException : You have requested a non-existent service "honeypot". dans Drupal\Component\DependencyInjection\Container->get() (ligne 156 de /home/sitename/public_html/web/core/lib/Drupal/Component/DependencyInjection/Container.php).Then the error may be an incomplete service that update.php does not discover properly.
Comment #7
tr commentedI don't think there's any problem with the service definition - if there were then rebuilding the cache wouldn't have fixed it ...
It really does seem that your container doesn't know about the 'honeypot' service - that's what the error message is saying. But as I said, the container should be rebuilt when update.php is run. It may be just that a cache rebuild is always necessary after updating a module (I know I always do this out of habit, and a lot of the "official" Drupal documentation says to do this.) An updated module may have changed class names and namespaces (internal names, part of the implementation not the module API), added or updated service definitions, etc. All these are allowable changes in minor point updates. But I really don't think rebuilding the cache is something that a contributed module should be doing or should have to do in order to make allowable updates work properly.
Regardless, I could add this empty post-update hook, but it seems a little silly. This is occasionally done in core and some contributed modules, but is certainly not the norm as far as I can tell. Would it be possible for you to test it by re-running the update with this patch?
Comment #8
tneo commentedI had the same issue in a multi-site set-up. I was not able to log-in into a site. Forcing the update.php to run for the affected site resolved the issue.
Comment #9
yktdan commentedI got the site running by clearing the cache with phpmyadmin. After doing so I ran update.php and it said no updates. I do not have drush installed so that is not an option for me (and probably many who are not site developers). I take this to mean that clearing cache is the important operation, not running update. If you are logged on as admin when you run composer update, your site is down and manually clearing the cache may be the only option.
Comment #10
john_b commentedUpdate to Honeypot 2.1 on PHP 8.1 also crashed my site.
WD error
TypeError: Drupal\honeypot\HoneypotService::getProtectedForms(): Return value must be of type array, null returned in Drupal\honeypot\HoneypotService->getProtectedForms() (line 164Cache rebuild with 'drush cr' fixed it.
Comment #11
xmacinfoTested the patch in #7 directly on 2.1.0 and it solves the issue.
Site 1a
git apply.drush updb./contactpage loads correctly.Site 1b, to double verify
drush updb./contactcrashes, same error as in #6.git apply.drush updb./contactpage loads correctly.Marking RTBC.
Thanks.
Comment #13
tr commentedThanks for testing it @xmacinfo - that helps a lot!
Committed.
Comment #14
tr commented