Closed (fixed)
Project:
Memcache API and Integration
Version:
8.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
12 Jul 2024 at 07:54 UTC
Updated:
29 Sep 2026 at 18:55 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #3
spokjeThe same happened for me when updating from 2.5 to 2.6.
memcache_admin_post_update_add_service_definitionsinvalidated the container, as intended, and afterwards local/development/whatever environments with this module enabled whilst having neither Memcache nor Memcached installed fail with a 500Uncaught PHP Exception Drupal\memcache\MemcacheException: "No Memcache extension found".Comment #5
spokjeThe MR solved our use case (having
drupal/memcacheenabled, but neither Memcache nor Memcached installed), but is at best "iffy".Not even sure how this situation came to be, since it seems to be not possible to enabled this module without having either Memcache or Memcached installed (See also #3136253: Disable memcache on local or dev environments (Drupal 8)), but here we are.
A "proper" solution would include decent tests, probably(?) a dedicated setting and the possibility to install without having either Memcache or Memcached installed.
But foremost, we need a blessing from the maintainer(s) if they want to support such a solution.
Putting this on NR in the hope this will attract that attention.
Comment #6
nicholassI had the same error one of our environments didn't have a good memecache compiled for its PHP. So you can also get to this situation if you had updated PHP in the past, but forgot to compile memecache the extension or choose not to.
BUT the patch did not fix it, so I think it needs work still, same error.
Another scenario is when using a service like TugboatQA which does not have memecache enabled.
Comment #9
japerryGood catch. Committed!
Comment #10
jrglasgow commentedAny chance getting a new release with this fix?
Comment #11
jrglasgow commentedI was having the same issue and ended up tracking it down to this issue... I have a different symptom. After running
composer updatemy `drush cr` failed with this message:the `drush updb` succeeded but had some
[error] MemcachedDriver::set() errorerrors.
I then put in a breakpoint where the exception was being thrown and traced it back to Memcache and reverted from 8.x-2.6 to 8.x-2.5 and the problem was resolved. Also updated to the latest dev release resolves the issue.
I am putting the specific errors I had in here to make it easier to find when searching.
Comment #12
dhansen commentedPushing for a full release of this fix. Our sites avoid dev versions as potentially unstable, and this is playing havoc with our testing pipeline and requiring significant workarounds for non-production environments.
Comment #13
marknatividad commentedI am also having a similar circular reference issue after upgrading to Drupal 10.3.1 and downgrading memcache to 2.5.0.
After running
drush crI get the following error:Comment #14
paulsheldrake commentedThis is still an issue on the 2.7 release
Comment #15
paulsheldrake commentedDowngrading to 2.5 worked for me to fix. Not ideal obviously
Comment #16
japerryWell shoot. Lets see if there are other reports and then re-escalate as a bug. I'll try to reproduce the issue, but it won't be until next week or early September though.
Comment #17
spokje@paulsheldrake What are the symptoms of the issue on 2.7?
Any errors showing in the log, on screen, etc?
Comment #18
dhansen commentedCircling back:
the fix on 2.7 seems to work for me. Note that I did need to run drush updatedb which ran add_service_definitions from memcache_admin to clear an error that appeared.EDIT: I was wrong. Still breaking on my staging environment. Looks like memcache was added locally because of this issue.
Issue I'm seeing is:
The website encountered an unexpected error. Please try again later.
Drupal\memcache\MemcacheException: No Memcache extension found in Drupal\memcache\Driver\MemcacheDriverFactory->initialize() (line 179 of modules/contrib/memcache/src/Driver/MemcacheDriverFactory.php).
Comment #19
wellsHmmm same here. I swear this fix worked initially, but now I am seeing the same error as #18 again in 8.x-2.7.
Comment #20
wellsAh, wait, I see -- in my local environment I have a config that is equivalent to:
But, I did not have that in a remote test environment I was looking at. Hence the confusion. The errors goes away when those settings values are set to empty arrays.
From the discussion it sounds like there is some history to this, but I wonder if there is any way to prevent this error without also requiring that config?
Comment #21
seanrI'll second this - it should fail much more gracefully than it does. When I have time, I'll see if I can work up a patch for that.
Comment #22
gallant_dev commentedAs a data point, we are seeing this issue on 2.7 as well. Adding the lines in settings.local.php works for local but adding to environmental conditional statement in settings.php does not work on dev/staging server environments (Acquia). Running drush commands results in error "Memcache instance could not be initialized. Check memcache is running and reachable".
Reverting to 2.5 seems to be the only solve for now. Core 10.3.9
Comment #23
oumayma elhaddam commentedI switched back to 2.5 for drupal 10.4.1 and worked for me , waiting for a fix
Comment #24
skyredwangsame here. back to 2.5 for now
Comment #25
lawxen commented'drupal/memcache:2.x-dev@dev' still has the problem
Comment #27
lawxen commentedComment #28
seanrLooks like a failing test on that MR - putting back to needs work.
Comment #29
skyredwangA simple fix based on what has already been committed.
Comment #30
japerryThe reports since then the initial commit are a different situation: the opt-out was in settings.local.php but not on the staging, so those environments had the module enabled with neither a memcache extension/server nor the opt-out. #22's "Memcache instance could not be initialized" text comes from Acquia's memcache-settings include, not from this module. Those environments need the same two lines, or should not have the module enabled there (config_split etc.).
The changes to MR44 and 29 both make a *missing* setting mean "disabled". We don't want to do that: