We've faced issue with
drush cr
is not able to rebuild config_cache bin when using memcache
This leads to unexpected behaviour

- deploy new DB
- run drush cr
- enable some custom module "example"
- deploy one more time same DB
- run drush cr
- run drush en "example"
- it says that module already enabled, because config_cache in memcache still contains old value

So the fast fix for this is to remove the bin for not handling by memcache

$settings['cache']['bins']['config'] = 'cache.backend.database';

Comments

podarok created an issue. See original summary.

damiankloip’s picture

Memcache deleteAll() currently just calls invalidateAll(), So I guess that's the reason. I guess config code using the cache uses $allowed_invalid maybe? Or do you have nay other thoughts about what the problem is?

EDIT: No, I don't think it does use allow invalid..

vurt’s picture

I was able to reproduce the problem with a similar test:
- create db dump of working drupal db
- drush cr
- enable a module
- restore the db dump
- drush cr
- enable module fails

The quickfix from podarok helps...

bkosborne’s picture

Note that despite configuring a site to use memcache backend as the default via $settings['cache']['default'] = 'cache.backend.memcache';, the site will still use a the "chainedfast" backend for bootstrap, config, and discovery caches.

See https://drupal.org/node/2327507 and https://drupal.org/node/2754947 change records for more information on this.

Perhaps this is relevant since the issue at hand is related to the config cache, which uses a chained backend. I believe the "chained" aspect of this is that it first will use APCu cache as a front cache, and then fallback to the default, which in our cases will be memcache.

So, maybe the problem is not with memcache, but instead with APCu.

bkosborne’s picture

Also, I haven't taken the time to try and reproduce this myself, but I could suggest the following to try and fix, assuming APCu is the culprit:

// Set main cache backend to use.
$settings['cache']['default'] = 'cache.backend.memcache';
// These bins have their own defaults defined in their service definition and are configured to use the "chainedfast"
// backend, which attempts to use APCu in front. Override to have them use memcache instead.
$settings['cache']['bins']['bootstrap'] = 'cache.backend.memcache';
$settings['cache']['bins']['config'] = 'cache.backend.memcache';
$settings['cache']['bins']['discovery'] = 'cache.backend.memcache';
damiankloip’s picture

Status: Active » Postponed (maintainer needs more info)

Yes, I would try that and see if you still have problems, or make sure the chained fast backend is still using the database, you can do that by setting the memcache backends explicitly, or adding 'cache.backend.database' as an additional parameter to the 'cache.backend.chainedfast' service definition.

vurt’s picture

I wanted to add that this problem is not too serious:
For the daily workflow using configuration export and import memcache works fine as a backend for the config. The problem only exists when a new database is used - which happens less often (and for some people never...).

slydevil’s picture

Status: Postponed (maintainer needs more info) » Active

My issue is with managing fields on a content type.

  1. I create a new field, set it to required.
  2. Edit the field, the required checkbox is not checked
  3. clear the cache
  4. Edit the field, the required checkbox is checked

The same thing happens when I try to manage form display or manage field display.

The only setting I have is this:

$settings['cache']['default'] = 'cache.backend.memcache';

If I add the suggestion from comment #5, it makes no difference:

$settings['cache']['bins']['bootstrap'] = 'cache.backend.memcache';
$settings['cache']['bins']['config'] = 'cache.backend.memcache';
$settings['cache']['bins']['discovery'] = 'cache.backend.memcache';

But setting the config cache backend to database definitely fixes the issue, however it's not ideal in my opinion:

$settings['cache']['bins']['config'] = 'cache.backend.database';

Edit: Using Memcached with PHP 7.0.3 via socket file.

webchick’s picture

catch’s picture

Status: Active » Postponed

Postponing this on #2484595: Add mechanism to support invalidateAll and deleteAll which is the most likely culprit.

fabianx’s picture

Status: Postponed » Active

Back to active, the issue is in.

Needs to be re-tested now

vurt’s picture

I did test my testcase from #3 again an now it works!

I also checked #8 and I could not reproduce the problem. @slydevil It may be a good idea that you test the current version.

damiankloip’s picture

Status: Active » Fixed

ok, closing for now. @slydevil, if you test again and still hit issues, please re-open. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.