I am using the Varnish module with Varnish 4, and I'm trying to set up the Cache Expiration so that inserted/updated nodes of a certain content type will expire the updated node and the home page. I have the status set to External with node actions of insert & update selected and urls of front page & node page to be expired.

After I update a node, I see this in my watchdog logs --
Expiration was executed for the next URLs:

URL:
Wildcard: false
Expired object: node
--------
URL: node
Wildcard: false
Expired object: node
--------
URL: node/240415
Wildcard: false
Expired object: node
--------

Neither the node or the home page are actually updated when I refresh the page. If I manually flush the page cache, then the updates are reflected (which is why I think Varnish is working okay.)

Any suggestions?

CommentFileSizeAuthor
#7 2508970-4-clear-internal-cache-too.patch468 bytesrupertj

Comments

spleshka’s picture

Do you use external expiration or internal (module settings) ?

skoehn180’s picture

I have external expiration selected

WebWalker3D’s picture

Is there any update on this? I'm also experiencing this issue, both with dev and regular release.

lolcode’s picture

I have the same issue also using varnish and with external expiration selected.

Going by the request headers it looks very much like the varnish cache is getting cleared (now that I have applied the patch here: https://www.drupal.org/node/2558729) but that the internal cache is not being cleared so that varnish gets the same page again. After the expire is triggered and recorded in watchdog I can re-request the page as an anonymous client and get th

Request URL:http://mysite.org/news/test-news-item-scheduling-again
Request Method:GET
Status Code:200 OK
Remote Address:xxx.yyy.0.159:80

Accept-Ranges:bytes
Age:0
Cache-Control:public, max-age=3600
Connection:keep-alive
Content-Language:en
Content-Length:28637
Content-Type:text/html; charset=utf-8
Date:Thu, 05 May 2016 17:30:45 GMT
Etag:"1462469317-0"
Expires:Sun, 19 Nov 1978 05:00:00 GMT
Last-Modified:Thu, 05 May 2016 17:28:37 GMT
Link:<http://mysite.org/news/test-news-item-scheduling-again>; rel="canonical",<http://mysite.org/node/18560>; rel="shortlink"
Server:Apache
Vary:Cookie
Via:1.1 varnish
X-Content-Type-Options:nosniff
X-Drupal-Cache:HIT
X-Generator:Drupal 7 (http://drupal.org)
X-Powered-By:PHP/5.6.20
X-Powered-By:PleskLin
X-Varnish:1298395723

In fact I was able to work around the issue by making a change in expire.api.inc lines 109-114:

     if ($status == EXPIRE_STATUS_ENABLED_INTERNAL) {
       self::executeInternalExpiration($urls, $wildcards);
     }
     elseif ($status == EXPIRE_STATUS_ENABLED_EXTERNAL) {
       self::executeInternalExpiration($urls, $wildcards);
+     self::executeExternalExpiration($urls, $wildcards, $object_type, $object);
     }
joinso’s picture

Hi!

I have the same problem.
I'm using 7.x-2.0-rc4+5-dev, with External Expiration (MemCache API).

Any idea?

Regards,
JOINSO

joinso’s picture

I changed to MemCache Storage, and It doesn't work.

Regards,
JOINSO

rupertj’s picture

Component: User interface » Code
Category: Support request » Bug report
Priority: Normal » Major
Status: Active » Needs review
StatusFileSize
new468 bytes

Here's a patch that implements lolcode's fix from #4.

I think the UI could be improved a bit as well as this, to make it clearer what's going on, but given how clearing an external reverse proxy cache doesn't actually seem to work at the moment, getting this part fixed first would seem to be important.

joinso’s picture

I made some test with MemCache, and I see that doesn't work as expected.
It says that the urls was expired but not.
This urls belongs to Panels Page Variants.
Expire invalidates Panels Page Variants caches also?

Regards,
JOINSO

rupertj’s picture

JOINSO - have you tried the patch I posted (or lolcode's suggested edit - they're the same thing)? This fixes the issue for me.

joinso’s picture

Yes, I tried.
It doesn't work.
:(

The problem is that I have a Panel Page with Variant Displays, and it seems the cache_panels is not expired.

Regards,
JOINSO

johnennew’s picture

Status: Needs review » Reviewed & tested by the community

Surly an external cache clear also needs the internal cache clearing as well?! I feel like I'm missing some understanding or setup somewhere!

Patch in #7 does the job and makes the expire module work how I would expect.

Thanks

mfb’s picture

I'd echo that this patch makes sense.

I've had to create custom site-specific modules to take care of purging the internal page cache when using say Rules module to purge caches, which is easy enough but seems silly :)

michel.settembrino’s picture

Me too I can say that patch in #7 does the job and makes the expire module work how I would expect.

sgdev’s picture

May also want to examine a patch I just posted regarding a core bug that was fixed in D8 and never backported to D7:
https://www.drupal.org/project/expire/issues/2412517#comment-13170084

resetCache is being executed after the Expire module hooks, not before it.

sgdev’s picture

Also regarding the patch in #7, it looks like it is just re-running the expiration code twice to achieve the intended result. I don't think this is the right approach, it just masks the underlying issue. Please review the patch I referenced in #14. Thank you.

sgdev’s picture

I just examined this more closely and I think I understand why a patch like this needs to exist.

We're using both Varnish and Redis, Our Varnish logs look fine when purging pages. However, Redis is storing to cache_entity_* bins using the Entity Cache module. I think I need to write a patch to provide support for this.