When running a 'drush cache clear' the CLI should output the user cache is not cleared and how to properly clear this.

#20 drupal_apc_cache.inc_.patch1.01 KBsirviejo



The webserver and the client run in different memory segments. So it's not possible to clear the APC cache using drush. You can use different methods for clearing the cache.
1) Use the clear all caches in the Drupal website.
2) Setup the apc.php script somewhere on your webserver to clear the cache. Use `locate apc.php` to find it on *nix.

Status:Active» Fixed

Comitted to dev.

Status:Fixed» Closed (fixed)

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

This has to be one of the most annoying error messages ever. Most Drush commands return the error multiple times. How do I turn OFF the message?

This has to be one of the most annoying error messages ever. Most Drush commands return the error multiple times. How do I turn OFF the message?

I agree. When I run drush cc all I get the message like 60 times...

Edit: Opened new issue for fixing this behavior: #1565716: Make "drush cc" clear cache on the webnode itself

Does it mean that I can't use Drush successfully on the site with APC cache?

No, you can use Drush on APC enabled sites. However, the messages produced by the Drush / APC combo are annoying and only point back to this post, not a solution.

Note: despite the annoyance of the messages, APC really is the best working caching solution for me and Drush is the best way to get monotonous maintenance tasks done with Drupal, so, a little inconvenience in a "best of breed solution" is, unfortunately, acceptable.

So no solution yet, but where is this problem getting worked on?

Is it with the memcache module? drush? memcache itself? php?

Would be good to have some hope that in a few months we won't have to deal with these annoying messages.


@Orkut: the 7.x-1.0-beta4 already includes this (very annoying) message.

See #1565716: Make "drush cc" clear cache on the webnode itself for the follow-up.

Sorry for the wrong comment. I've edited it.

The problem is with the fact that the Drush (CLI) PHP instance does not address the same memory segment as the one used by the PHP server SAPI in use, so any action it can take, assuming apc.enable_cli is on (it is off by default) only affects its own segment and not the one in use by the PHP server. So the only way to really perform a cache clear from the CLI is to connect to the webserver, assuming proper credentials (which cannot be guessed, since the password is hashed), and trigger a server-side clear.

Seems like there is no way to solve it.
Maybe there is a way to mute the warning? It is very disturbing.

@jeffreycai, the warning is there for a reason: your cache isn't cleared. The only way to clear your cache (atm) is by clearing it from your website (admin/config/development/performance).

This will be addressed somewhere in the future, hopfully soon.

I'm getting the same as others but for every drush command I do.

So performing an install of a new module causes the output of 100+ lines of just:

cache_bootstrap(variables) was not cleared. APC cli uses a different memory storage then the webserver. For more info see:               [warning]

Any way to fix this or mute/move the warning elsewhere?


Status:Closed (fixed)» Patch (to be ported)
new1.01 KB

Here is a patch to show warning message only the first time.

Just an idea: maybe the built-in server in PHP 5.4 is using the same APC segment and could be used in that case ? Just an idea before I forget it.

I applied patch, now message feed has gone which is very useful for readibility (and I accepted that cache is not cleared :) )

Rethought this, and we have a way to make it work, I think:

  • Drush commands have access to the URL of the current instance
  • They could temporarily activate a menu entry on some URL of the site during their execution
  • Then fetch that URL with drupal_http_request()
  • The page callback would then disable the menu entry again and flush APC
  • The post_execute hook of the command could double check the menu cleanup in case something went awry and disable it forcefully
  • Alternatively, and possibly more efficiently, the URL could be always open, but use a token generated by the drush command to actually perform the flush

That way, the drush cc could indeed flush the web APC.

> Drush commands have access to the URL of the current instance

I tried that already, but when a site is in maintenance mode, Drush has no access (HTTP Error 503 - Service unavailable). That's why I use XMLRPC instead of a menu callback.

Good point, but it does not change the general logic (and need for the token or dynamic enabling).

Please use this issue for clearing cache from Drush/CLI: #1565716: Make "drush cc" clear cache on the webnode itself

Status:Patch (to be ported)» Closed (duplicate)

Discussion moved to #1565716

applying #20 leads to :
in my case, and this is not recoverable after apc upgrade...