Closed (fixed)
Project:
Chaos Tool Suite (ctools)
Version:
6.x-1.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
17 Feb 2010 at 15:28 UTC
Updated:
30 Jun 2010 at 19:30 UTC
Coming from #504552: Problems with panels styles CSS and JS on cached pages.. Hook_flush_caches() is being run by system_cron(), so every cron run CTools CSS files are removed. Not only this is bad idea, but also it breaks cache strategies which don't involve cache_page clearing on cache_clear_all(NULL, "cache_page") (e.g. Memcache API).
Comments
Comment #1
crea commentedI've just tested that it also breaks "minimum cache lifetime" setting with core cache.inc. I've also verified that temporary ugly workaround fixes this problem for "minimum cache lifetime" setting too.
Basically any cache logics which doesn't do immediate flushing of cache_page table/bin is going to be broken.
Comment #2
merlinofchaos commentedInteresting. Maybe I misunderstood how hook_flush_caches is supposed to work, then, because I didn't think it happened every cron.
Comment #3
merlinofchaos commentedWell crap. That is absolutely ridiculous design on core's part. Plus, the fact that this is called on cron is completely undocumented.
But that said, that should flush the page cache at the same time that our CSS cache gets flushed, shouldn't it? How come this doesn't totally break all caching? This is very confusing.
And if we do this, then we no longer will be able to clear the CSS cache with devel's "clear caches" button, which is important.
Comment #4
merlinofchaos commentedOk, after some discussion with Moshe and sdboyer, I understand now that the cache clear that happens on system cron may not always clear the page cache. I agree this is ultimately probably causing that problem, and Drupal gives me no way to check to see what kind of cache flush we're doing.
Comment #5
torgospizzaSubscribing, seeing this issue as well with latest (6.x-1.3) CTools and CSS aggregation enabled.
EDIT: I'm testing the patch from #504552-119: Problems with panels styles CSS and JS on cached pages. - will post back with results.
Comment #6
ianchan commentedsubscribe
Comment #7
rismondo commentedsubscribe
Comment #8
hongpong commentedSubscribing - I had issues with mini panels CSS maybe getting caught possible because of this - crossposting the related issues (not trying to spam)
The main thread for Panel Nodes #504552: Problems with panels styles CSS and JS on cached pages.
The feature req to fix mini panels/block caching is: #675844: Mini panels should tell Drupal core they cannot be cached with block caching
Duplicates of related problem #539228: Panels not displaying correctly for anonymous users // #534358: Bizarre intermittent behaviour of panels
Related cache hook issue #717036: Remove css cache clearing from hook_flush_caches() (Duplicate: #626562: Panel page's ctools CSS file may expire while page is cached - may break panel for anonymous users )
Comment #9
merlinofchaos commented#8: #675844: Mini panels should tell Drupal core they cannot be cached with block caching adequately explains the problems. Why are you spreading that out onto other issues? That is rude and causes confusion. Please stop. It is completely unrelated to this.
Comment #10
Flying Drupalist commentedSubscribe.
Comment #11
crea commentedThis could be fixed with a core patch to drupal_clear_css_cache(), something like
Then CTools could just implement this hook.
Comment #12
ManyNancy commentedThis is not a bug that you can live with, panels is pretty unusable without its css.
What are the downsides to temporary workaround in #1?
Comment #13
crea commentedThe downside is that anonymous page cache is completely cleared every cron run
Comment #14
steven jones commentedSurely the approach to CSS and JS caching is all backward in ctools at the moment?
Currently the server is trying to keep track of the css and js files sent to the client, and only send ones it doesn't already have. Putting the data in a really fragile cache though, is not a good idea. Try adding a node with a ctools modal, then click another ajax link on the same page, for example.
Isn't the client better placed to know what CSS and JS files it has been sent? Rather than store the array of sent CSS and JS file on the server in a cache, can't we send that data over to the client, and let the client decide if it should be adding CSS and JS on an AJAX request.
Comment #15
merlinofchaos commented#14: Your comment is interesting and valuable...and totally on the wrong issue. Please post this somewhere more relevant so we don't take over an important conversation.
Comment #16
steven jones commentedSorry merlin et al. there are too many levels of caching to keep track of these days.
Comment #17
eugenmayer commentedWell just back on the issues, yes that causes problems. AFAIK there is an open issue in panels or ctools, where ctools generated CSS files are not included after cron run. you have to clear the cache to get it back working. The css file with the hash name is simply missing on the FS, but i.e. still in memcache cachepages somehow.
I think this could be related to this.
Comment #18
Chris Einkauf commentedSubscribing.
Comment #19
merlinofchaos commentedI added a check for the CRON semaphore (not sure why I didn't see that the last 20 times I looked at this). That may finally get rid of this issue. Keeping fingers crossed.
Comment #20
crea commentedI'm afraid this is only a weak workaround. Any module could invoke hook_flush_cashes() just to gather information (this is an informational hook).
But it's much better than nothing ofcourse. We have to live with it in the absence of the other reliable solution.
Comment #21
merlinofchaos commentedI agree, but I would like to point out that the way the hook is named and the documentation for the hook do not actually make it appear to be an informational hook. I personally feel this is a bug in core, and we are simply working around it as best we can. We should check to see if this behavior is changed in D7 -- I think there may be an issue but I haven't the time to go find it right now.