Hello. I installed memcache and some pages of my site don't get updated for anonymous users. For example, when users post new blog entries, /blog page is not refreshed in cache. Same thing with new comments not displayed, deleted information still displayed for anonymous users etc etc. I guess it's problem with cache_page but there is maybe more general problem with my site. I think it is clearly cache related problem cause everything works ok in general, and pages work ok for logged in users.
Here is my setup:
'memcache_servers' => array(
'localhost:11211' => 'default',
'localhost:11212' => 'cluster2',
'localhost:11213' => 'cluster3',
'localhost:11214' => 'cluster4',
'localhost:11215' => 'cluster5',
'localhost:11216' => 'cluster6',
'localhost:11217' => 'cluster7',
),
'memcache_bins' => array(
'cache' => 'default',
'cache_page' => 'cluster2',
'cache_menu' => 'cluster3',
'cache_filter' => 'cluster4',
'cache_content' => 'cluster5',
'cache_captcha' => 'cluster6',
'cache_views' => 'cluster7',
),
);
Drupal 5.6 with serialize patch, views and cck serialize patches applied too. I have 7 memcache daemons that run on ports listed above. At admin/performance caching mode set to normal caching. Memcached daemon version 1.2.2, PHP 5.2.6 compiled as fast-cgi with pecl memcache version 2.2.3 and eaccelerator 0.9.5.3 extensions.
Please tell me if anything wrong with my setup or what direction to look in to solve my problem. Thanks
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | memcache.inc_.patch | 1.64 KB | jeremy |
| #16 | memcache.db_.inc_.patch | 1.83 KB | jeremy |
| #11 | wrong_table_flush.patch | 1.05 KB | chx |
| #2 | wrong_table_flush.patch | 1.04 KB | chx |
Comments
Comment #1
crea commentedTo be more clear, I have minimum cache lifetime set to "none", if I understand it correctly that should mean invalidate cache_page immediatly if content is changed
I use http://drupal.org/node/152983 for manual clearing and it works ok, but ofcourse it's not solution to my problem
Comment #2
chx commentedThis is as bad as it can be because currently we flush the NULL table and that leads to flushin 'cache' instead 'cache_page':
Comment #3
slantview commentedThere is a typo when you are trying to set the table to 'cache' you have an == instead of an = sign. Also, how is this different? I read this as you would rather flush 'cache_page' but in this patch you are still attempting to set it to cache. you just changed the ternary operator into a full if statement. Am I missing something?
Comment #4
allie mickaComment #5
nicholasthompsonSlantview, its similar...
The ternary sets $bin to be 'cache' if $table is empty, otherwise sets it to $table.
The patch, on the other hand, sets $table to 'cache' if $table is empty.
Whats wrong with flushing cache if you've not specified a table? If a table is not specified, should $table be "*"?
Comment #6
crea commentedHmmmm.... How this kind of bug could exist after so many people use memcache module ? If page cache is not flushing at all that means site is almost not working :(
These moments just make me think how much of importance proper software testing is. Guess all you guys use cache and cache_page tables in one memcache bin so you don't notice this problem (in that case 'cache_page' is flushed together with 'cache' )
Comment #7
crea commentedSo you say, after update of content function cache_clear_all() is called without $table argument
It seems so, for example from the end of node_save function in core
from original cache.inc:
Guess we should follow same rule then and flush cache_page if both $cid and $table are null
Comment #8
crea commentedchx, what version of memcache module you made your patch against ?
It wouldn't apply anyway, because there is no such line
You messed it a bit :)
I guess error comes from using variable $bin in $table argument check. There is line
but it's not working because we dont use $bin anymore in the function. Proper patch should include checking like this
if (!isset($cid) && !isset($table))and setting $table variable to 'cache_page' instead of $bin variableComment #9
crea commentedIt seems cache_clear_all() needs serious rework, cause comments like this don't make any sense
It actually DOESN'T match default drupal behavior when cache_clear_all() is called without arguments to flush cache.
This is awful.
I guess we should check if $table and $cid are null then set $table to 'cache_page' and call dmemcache_flush($table) ( it isn't called now, because $cid is null and we "don't do anything if cid is unset" :P )
Comment #10
crea commentedThe following change fixed bug for me. Please test it too.
But I guess function code needs major rework to make code more clean ( and to remove nonsense comments :P )
Comment #11
chx commentedOf course this needs to be cache_page...
Comment #12
crea commentedchx, did you read my comments ? Your patch will not work because $cid is NULL too and dmemcache_flush() won't run.
Also this patch will not apply too ( same as above )
Comment #13
crea commentedFunny thing is, in memcache.db.inc there is correct code that handles flushes:
but somehow this code didn't make it to memcache.inc ... :)
Comment #14
chx commentedNo time to work on this. I found the bug I let others patch it, we run our own hacked version which never flushes page_cache but lets invidual items expire after 300s.
Comment #15
dgtlmoon commentedsubscribing, this aint good :D
Comment #16
jeremy commentedHere are patches for memcache.inc and memcache.db.inc, updating the logic and the comments.
Patches were sponsored by ConsumerSearch.
Rather than adding a second call to dmemcache_flush, I update the parameters and fall through to the correct place. This way the same logic works in both memcache.inc and memcache.db.inc, and we don't have to recursively call ourselves as was happening in memcache.db.inc.
Comment #17
jeremy commentedCommitted to development branch.
Comment #18
jeremy commentedAlso committed to DRUPAL-5 branch.
Comment #20
jeremy commentedThis bug still affects the 6.x version.
Comment #21
jeremy commentedPatch ported to 6.x, committed.
6.x debugging sponsored by ParentsClick / Lifetime Digital.
Comment #22
jvandyk commentedIn D6, the cache_block table needs flushing too. See comments in cache_clear_all() of memcache.db.inc.
Comment #23
jeremy commentedThanks for catching that -- fix committed.