Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear APCu cache, if installed, after site-install command. #4803

Closed

Conversation

bradjones1
Copy link
Contributor

@bradjones1 bradjones1 commented Aug 2, 2021

When re-installing a site, e.g. during local development, caches are not cleared. This makes sense in so far as database tables are dropped prior to install, and so most of Drupal's db-backed caches will be empty by definition. However, the chained fast cache backend uses APCu if present/available. This backend is used by, among other things, the extension list API for storing definitions of installed modules.

This can result in cache data inconsistency when, for instance, modules are excluded from export in $settings['config_exclude_modules']. If an excluded module is installed, and then the site re-installed, Drupal will continue to see a modules list from the APCu cache which includes the module, though it wasn't actually installed from config. An edge case for sure, but an edge case nonetheless.

This could theoretically extend to other cache backends such as redis/memcached/etc., however I think it makes sense to accommodate for this condition in Drush core because Drupal core itself supports APCu. The other cache backend types are in contrib-land and would thus be reasonable to place on the developer to lifecycle themselves.

@weitzman
Copy link
Member

weitzman commented Aug 2, 2021

Alas that doesnt actually help with web requests. See #2450 (comment)

@bradjones1
Copy link
Contributor Author

bradjones1 commented Aug 2, 2021

@weitzman I think we may be talking about different things? This is all at the CLI. The steps to reproduce are something like:

  1. Have a dev-only module, let's call it module_dev. Include it in $settings['config_exclude_modules'] so it is not dumped to core.extension.yml on config export.
  2. Enable the module, e.g. drush en module_dev. This busts the list of enabled extensions in the fast chained cache/APCu.
  3. drush si --existing-config to reinstall the site - same container, no out-of-band cache clear of APCu.
  4. drush en module_dev after re-installation returns [notice] Already enabled: module_dev.
  5. drush cr
  6. drush en module_dev now completes successfully.

The older MR you note above is for the cache clear command, not the installer... I'm guessing you noted that before commenting, though. Thoughts?

@bradjones1
Copy link
Contributor Author

I appreciate the rubber-ducking; indeed, this was redis, not APCu. Sorry for wasting maintainers' time.

@bradjones1 bradjones1 closed this Aug 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants