Since 8.x-2.9, a site whose memcache server is unreachable can fail every request with:
Circular reference detected for service "module_handler", path: "module_handler -> cache.bootstrap -> logger.factory -> logger.syslog -> config.factory -> config.typed".
While an unreachable server should only mean the site runs without that cache, unfortunately the site, including drush status, is down until the memcache server comes back.
According to claude, the failure logging added in #3480143: Log connection failure is the cause:
- The bootstrap cache bin is created while the container is constructing
module_handler. Creating the bin reads its last deletion timestamp from memcache. - The read fails, and the driver logs the failure through
logger.factory. - Building
logger.factorybuilds every registered logger. Core's syslog logger needsconfig.factory, which needsconfig.typed, which needsmodule_handler, which is still under construction.
It appears that any logger depending on the config factory triggers this. Sites that only use dblog are not affected, because that logger only needs the database. Note, the fallback in #3480438 does not help here either.
When a site is using APC, the failure is logged according to the failure_log_interval (every 60 seconds by default), so only one request per interval hits the fatal. Drush has no APCu on the command line by default, so every drush command fails while the server is unreachable.
Since kernel tests run on the container builder, it did not catch this because it tolerates circular references at runtime.
Issue fork memcache-3641652
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
owilliwoConfirming this on a production site (Drupal 11.4.13, memcache 8.x-2.9 then 8.x-2.10, Acquia, syslog enabled): three 500s over ten days, each during a memcached outage, one request per web node per failure_log_interval.
One more entry point than module_handler, in case it matters for the test coverage. Our production traces start from an HTTP middleware that needs the config factory early, so the bin being built is cache.config rather than cache.bootstrap:
http_kernel -> http_middleware.remove_http_headers -> remove_http_headers.config_manager -> config.factory -> config.storage -> cache.config -> logger.factory -> logger.syslog(Drush on the same site hits the module_handler -> cache.bootstrap path
described in the summary.)
Tested MR !83 on 8.x-2.10 with the memcached extension, APCu and syslog, the
server pointed at a closed port:
drush statusfails;drush statusboots, and the failure is written to the Drupal log on the next failing read, as described.