MySite Cache: Content does not update

kforet - July 11, 2007 - 05:33
Project:MySite
Version:5.x-2.3
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Description

agentrickard,
Now I have another problem. The content on the My Site page is not getting updated. Currently it is 3 days old. This includes the weather module, news sources and content from the site itself. They all go back to the seventh which is also when I uploaded the lastest version. I am running cron job every 4 hours.

#1

agentrickard - July 11, 2007 - 13:44
Category:bug report» support request
Status:active» active (needs more info)

Some of the content doesn't require cron at all. Aggregator and Weather are likely cached by the core modules.

This problem should not be internal to the MySite module. The module's cache settings (if you have turned them on) only last for a maximum of one hour.

Questions:

1) Do you have page-level caching turned on for your site?
2) For what users looking at whose MySite page is the content not updating?

#2

agentrickard - July 11, 2007 - 13:54

A URL would be helpful as well.

#3

kforet - July 13, 2007 - 13:53

Page caching is turned on and set to normal. I am currently experimenting with the module so it is my personal page and me accessing it. Here is the URL you asked for:

http://www.diatribune.com/mysite/kerry

#4

agentrickard - July 15, 2007 - 01:17
Title:Content does not update» Content does not update for anonymous users

Thanks. I suppose I will create an account and see.

As an anonymous user, most of the default MySite page is blank.

OK, I created an account, and everything updated. http://www.diatribune.com/mysite/agentrickard

It appears to me that Drupal's page cache is setting the content for anonymous users to a default state -- this is likely due to access control settings in Drupal. MySite respects access control rules for nodes. So, for example, if anonymous users can't see any nodes on your site, or they can't view comments, then the Recent Comments block on MySite will show blank.

Try modifying the core access controls for anonymous users and see if that affects display.

See especially the following permissions:

- access comments
- access content

This is also true of any sort of node_access module (like OG) that you have installed. All MySite data queries are filtered through Drupal's access control system.

So it seems to me that everything is working as designed. Does this make sense?

Note: changed title to reflect the issue more accurately.

#5

agentrickard - July 15, 2007 - 01:31
Status:active (needs more info)» active

Odd. I created an account and it let me create a MySite page, but now my username [agentrickard] is unrecognized. I can't login and I can't request a new password.

#6

kforet - July 15, 2007 - 18:30

Sorry about that. I had a Friday 13th expierience, database got corrupted, most recent backup was from the 10th so when I imported the backup your account was lost. My fault for not having more current backup. It seems like whenever anything is updated on My personal page like the backup all the data refreshes once, but then does not refresh again.

#7

agentrickard - July 15, 2007 - 22:20

Based on my test, it seems that you have MySite's internal cache turned on. That will cause the entire page content to be cached for X minutes. When you change content or settings, that cache is cleared.

Check your cache settings at /admin/settings/mysite. They are near the bottom of the options.

It is possible that something is wrong with the cache mechanism. (Especially if you don't have it turned on.)

My test: http://www.diatribune.com/mysite/agentrickard

#8

agentrickard - July 15, 2007 - 22:27

Unrelated note: The original style includes "red.css" and "blue.css" have been deprecated and should be removed.

Before deleting those files, you should run update.php, as it seems you may be running a version of MySite upgraded from 4.7 or 5.1.

The red and blue css files do not support the new JavaScript features.

#9

agentrickard - July 16, 2007 - 02:59
Title:Content does not update for anonymous users» Content does not update

I went back to the site later and you are correct, my page has not updated.

I suspect that you have MySite's internal cache turned on. Try turning it off and see if the problem goes away.

It may also be that the cache is not expiring properly, which might be a server time issue.

To dig further, I would need to know some values from your database.

Table: {variable}
Name: 'mysite_cache'
Value: What is this value?

SQL: SELECT value FROM variable WHERE name = 'mysite_cache';

Table: {cache}
cid: 'mysite:340'
expire: What is this value?

SQL: SELECT expire FROM cache WHERE cid = 'mysite:340';

#10

agentrickard - July 16, 2007 - 03:04

BTW: I have never seen this behavior on the demo site. I have page caching turned on at http://therickards.com/mysite/default.

My 'minimum cache lifetime' is set to 'none.' This is a core Drupal feature at 'admin/settings/performance'.

What is yours set to?

#11

kforet - July 16, 2007 - 22:42

I just turned My Site Cache off and it looks like it updated. I will keep an eye on it and let you know if that in fact fixed the problem. Thanks for sticking with this. I really been nice. It is much easier to work with and I love the droplets. If the content refreshes regularly now it is a geat addition to the site. Thanks,
Kerry

#12

kforet - July 16, 2007 - 23:08

As to the other questions you had. My "minimum cache lifetime" was also set to none.
These are the results I got from the DB queries:
the first was S:1:"0"
The second on the expiration was: expire = 1184539966
As stated earlier turning off cache on the module may have solved the problem. Thanks again for your help.

#13

agentrickard - July 17, 2007 - 01:41

Sure. I think you might have uncovered a deeply hidden bug, because MySite's internal cache didn't seem to be working correctly. I'll go test it on my demo site.

#14

agentrickard - July 17, 2007 - 02:19
Title:Content does not update» MySite Cache: Content does not update

When I just turned on MySite's Cache, some the Aggregator items disappeared. This is obviously a bug, and I'll have to track it down.

My suspicion is that there is something happening during the cache process that it causing an error in some content.

I think I may have found it. If the cache is on, some of the format files may not get loaded correctly. In that case, the content can't be rendered at all.

My development machine is still under repair, so no proper patch.

Add, lines 686:

<?php
     
if ($cache_set > 0) {  
       
cache_set('mysite:'. $mysite->uid, 'cache', serialize($content), time() + $cache_set);
      }
    }
    else {
     
// if reading from cache, we must load all the format includes
     
mysite_load_includes('formats', NULL, TRUE);
    }
    if (
$pageview) {
      if (!empty(
$data)) {
        print
theme('mysite_'. $mysite->layout .'_layout', $content);
      }
?>

Will roll a proper fix later this week and commit.

#15

agentrickard - July 17, 2007 - 02:36
Status:active» patch (reviewed & tested by the community)

Wow. This turned out to be worthwhile.

I had misunderstood the 'expire' value in the cache table. http://api.drupal.org/api/5/function/cache_set says

$expire One of the following values:

    * CACHE_PERMANENT: Indicates that the item should never be removed unless explicitly told to using cache_clear_all() with a cache ID.
    * CACHE_TEMPORARY: Indicates that the item should be removed at the next general cache wipe.
    * A Unix timestamp: Indicates that the item should be kept at least until the given time, after which it behaves like CACHE_TEMPORARY.

It is hard to say when the cache will get wiped (normally it's a garbage collection routine during cron). The MySite Cache is generally too short to be affected, so we have to manually check it:

Lines ~635

<?php
   
// the cache wrapper
   
$content = NULL;
   
$cache_set variable_get('mysite_cache', 0);
    if (
$cache_set > 0) {
     
$expire = db_result(db_query("SELECT expire FROM {cache} WHERE cid = '%s'", 'mysite:'. $mysite->uid));
      if (
time() < $expire) {
       
$data = cache_get('mysite:'. $mysite->uid, 'cache');
       
$content = unserialize($data->data);
      } 
    }
?>

Will incorporate this into the fix. Thanks!

#16

kforet - July 17, 2007 - 16:50

Thank you again for getting on this so quickly. I am not great with patches so I will probably wait for the next module update and leave cache off for now. Everything is updating on a regular basis now. Thanks again,
Kerry

#17

agentrickard - July 22, 2007 - 22:21
Status:patch (reviewed & tested by the community)» fixed

Committed to HEAD.

Thanks for the great report.

#18

Anonymous - August 6, 2007 - 04:38
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.