• Hello Donncha,

    we had issues with one of the sites, where the homepage was 5 days old, even though there were new posts every day. I was checking for possible plugin conflicts and so on.

    I noticed that when the plugin is installed, the Garbage Collector event wp_cache_gc is scheduled only as a “One-off event”. So I have to set the Scheduler -> Timer to 3600 seconds and hit “Change Expiration”, then I can see that it’s scheduled properly. Perhaps this stopped the homepage from refreshing?

    The wp_cache_gc is also not scheduled when upgrading the plugin from older versions (0.9.9) or switching from “Use mod_rewrite to serve cache files.” to “Use PHP to serve cache files.”. So we have to hit that “Change Expiration” button again. That means each time we tweaked some setting, the issue came back.

    What’s most confusing is, that this is not indicated on the WP Super Cache options screen, so we were not aware of any of these issues. There is visible check of the garbage collector cron job.

    Thanks,
    Martin

    https://www.ads-software.com/extend/plugins/wp-super-cache/

Viewing 15 replies - 1 through 15 (of 22 total)
  • Hello Donncha,

    please let us know what do you think about above.

    It appears that the plugin doesn’t work properly without Garbage collector, so we think it should run all the time or be turned on by default.

    Or are we missing something else?

    Thanks,
    Martin

    Good points. The gc job is a single event because garbage collection could take longer than the period between scheduled events. That might cause the garbage collection to run twice in parallel without using flags to tell the second job to not run. Unfortunately if a job fails or times out then the flag may not be cleared and GC won’t run at all until the system decides that the previous job had failed.

    Another way of doing it is by having a single event doing the garbage collection and using a scheduled job that checks if everything is running. This has it’s own complications too.

    One issue with upgrading is that in the past the plugin would clear it’s config files and clear up after itself. I’ve fixed this in the development version (but if you don’t use the dev version the config will be cleared as usual when you next upgrade). Part of the clearing up is removing the gc job. It’s not scheduled until you visit the settings page again ??

    The upgrading issue shouldn’t be a problem after the next release.

    I have this issue with pretty much all major pages – categories, tags, author, etc. Anonymous users get served a week old page.

    I have the option for “cache rebuild” (serves anonymous users a cached page while building a new one) checked. It does not happen.

    For the homepage, I actually added a function to clear its cache whenever it is updated. I couldn’t allow it to remain cached.

    I am now thinking that I will have no alternative but to write a function that clears out the cached file for every category/tag/author/taxonomy of a post when it is published/updated, which is quite cumbersome.

    But I have no idea how to solve this another way, and it is a rather acute problem.

    I would appreciate getting some guidance here.

    Thanks ??

    Bira

    Bira – try the development version or use the debug log in the plugin and examine the log. See if the paths in the logs are correct where the plugin records that it deletes cache files.

    https://ocaoimh.ie/y/2o

    Hello Donncha,

    so can you make sure the garbage collector cron is scheduled in the next version? We are not sure if there should be an option to disable it at all.

    Hello Bira,

    we had similar issues – just check your WP Super Cache Advanced settings and see if there is a “Next scheduled garbage collection will be at” message below “Expiry Time & Garbage Collection”. That will give you an idea if your Garbage collector is running.

    Thanks,
    Martin

    Hi Donncha, FolioVision,

    I am pretty sure there is a bug or a misconceived issue here. And I will try to explain myself better:

    1) I have ‘preload’ turned on for all posts. I do NOT have preload on for categories, tags, etc.

    2) I have garbage collection set to run every hour (3600 seconds) with timeout for files set to 600 seconds. It DOES state “next garbage collection <time>” on that page. However, it also states:

    “Warning! PRELOAD MODE activated. Supercache files will not be deleted regardless of age.”

    3) So category or tag pages have now been older than one week – and I see absolutely no method or way to make them refresh for visitors. It is a major issue for us.

    So the way I see it, despite NOT having preload set for categories and other taxonomies, garbage collection actually does nothing because preload is turned on for everything else. And, also, there is just never ever a method by which pages are refreshed. Despite having “Cache rebuild. Serve a supercache file to anonymous users while a new file is being generated” checked – it just never does anything to refresh these pages.

    The only pages that are fresh are posts, which get rebuilt when they are published or updated; and pages (such as the homepage) where I manually added prune_super_cache() to their update function…

    I should point out all this began since the latest upgrade, a couple of weeks ago.

    Thanks,

    Bira

    Bira – is a page updated when a comment is made?

    The taxonomy pages like tags and categories should be updated each time you run a preload because at the end of the preload it deletes any stale pages. Can you enable debugging and run a preload? You should see this recorded in the log.

    Well preload only ran once, Donncha. Or, to be precise, it ran over something like 10 days before everything was cached. And I don’t know if it’s running now except when a new post is added?

    Right now, this is the state of our Cache Contents (just refreshed):

    WP-Cache (1.28MB)

    35 Cached Pages
    18 Expired Pages

    WP-Super-Cache (1,095.79MB)

    12160 Cached Pages
    0 Expired Pages

    The cached pages number increases daily, of course.

    As for comments: we use the Facebook comments plugin so I don’t know.

    I added a function to sort out the categories issue to my functions.php – as things became rather urgent. My function is:

    function rgbtoi_prune_category_cache($post_id) {
    	if ( $post_id == null || empty($_POST) )
    		return;
    
    	if ( !isset( $_POST['post_type'] ) || $_POST['post_type']!='post' )
    		return; 
    
    	//verify post is not a revision
    	if ( !wp_is_post_revision( $post_id ) ) {
    		if (in_category(3, $post_id)) {
    			prune_super_cache( get_supercache_dir() . '/israel-and-the-region/', true );
    		}
    		if (in_category(4, $post_id)) {
    			prune_super_cache( get_supercache_dir() . '/jewish-times/', true );
    		}
    		if (in_category(5, $post_id)) {
    			prune_super_cache( get_supercache_dir() . '/israel-inside/', true );
    		}
    		if (in_category(6, $post_id)) {
    			prune_super_cache( get_supercache_dir() . '/ops-and-blogs/', true );
    		}
    		if (in_category(7, $post_id)) {
    			prune_super_cache( get_supercache_dir() . '/start-up-israel/', true );
    		}
    	}
    }
    add_action('save_post', 'rgbtoi_prune_category_cache', 15 );

    It’s not ideal, but at least it solves my immediate problem with regards to categories – which was the most urgent issue.

    I will remove it over night when there is little traffic (we got a few breaking news stories with heavy traffic at the moment) and will run debugging to let you know what it says.

    Thank you very much for your assistance – I do appreciate it.

    Hi Donncha,

    I turned on debug for all IPs and clicked on run preload now. I don’t see anything in the debug file about preload – and also pages that I access (anonymously, from a different browser) don’t seem to show up in the debug.

    However, something very typical for category and tag pages is that it says for all of them something like this:

    10:14:59 /topic/us-troops-in-afghanistan/ No wp-cache file exists. Must generate a new one.
    10:14:59 /topic/us-troops-in-afghanistan/ In WP Cache Phase 2
    10:14:59 /topic/us-troops-in-afghanistan/ Setting up WordPress actions
    10:14:59 /topic/us-troops-in-afghanistan/ Created output buffer
    13:15:00 /topic/us-troops-in-afghanistan/ Output buffer callback
    13:15:00 /topic/us-troops-in-afghanistan/ Anonymous user detected. Only creating Supercache file.
    13:15:00 /topic/us-troops-in-afghanistan/ Gzipping buffer.
    13:15:00 /topic/us-troops-in-afghanistan/ Writing non-gzipped buffer to supercache file.
    13:15:00 /topic/us-troops-in-afghanistan/ Writing gzipped buffer to supercache file.
    13:15:00 /topic/us-troops-in-afghanistan/ Renamed temp supercache file to /home/toi/public_html/timesofisrael.com/wp-content/cache/supercache/www.timesofisrael.com/topic/us-troops-in-afghanistan/index.html
    13:15:00 /topic/us-troops-in-afghanistan/ Renamed temp supercache gz file to /home/toi/public_html/timesofisrael.com/wp-content/cache/supercache/www.timesofisrael.com/topic/us-troops-in-afghanistan/index.html.gz
    13:15:00 /topic/us-troops-in-afghanistan/ Writing gzip content headers. Sending buffer to browser
    13:15:00 /topic/us-troops-in-afghanistan/ wp_cache_shutdown_callback: collecting meta data.
    13:15:00 /topic/us-troops-in-afghanistan/ Did not write meta file: wp-cache-64883f325d9610a57494746fd1a6e21b.meta *1* *0* *1*

    This, despite the fact that the file DOES exist, and despite the fact that it keeps serving an old cached file. There is no error in the file path listed above.

    Does this help in any way?

    Thanks,

    Bira

    Hello Donncha,

    I tested our issue of “Garbage Collector not being enabled after plugin install” in the most recent version from: https://ocaoimh.ie/the-development-version-of-wp-super-cache/

    It’s still not working out of the box. So after the plugin is installed, and I go to Advanced settings, turn on Caching, set it to mod_rewrite, check “Don’t cache pages for known users” and “Mobile device support”, then I hit “Update”. Then I have to update the .htaccess as there is a big notice, so you can’t forget that.

    But there is nothing about Garbage Collector. So it’s one extra step which has to be observed. If you don’t turn it on, then you might get into trouble. Perhaps it’s not a problem for smaller sites, but for bigger sites it’s a big problem.

    Thanks,
    Martin

    Thanks Martin, I’ll put in a check there and schedule the default garbage collection if it’s not enabled.

    Martin – I’ve added code that will check if gc is scheduled or not when you activate the plugin. Unfortunately I bet it annoys other people who don’t want to schedule a garbage collection! It’s hard to account for every sort of install..

    Hi Donncha,

    The issue is that pre version 1, WP Super Cache just worked.

    Now new installs and upgrades are fraught with danger, potentially leaving a server with all outdated files.

    The reason we recommended WP Super Cache over W3 Total Cache is how much less fussy WP Super Cache was.

    I wish you would go back to intelligent defaults with WP Super Cache. I.e. works out of the box. The tweaker/wankers will always prefer W3 Total Cache.

    Making the web work for you,
    Alec Kinnear
    Creative Director, Foliovision

    Hi Donncha,

    I would like to reiterate and add to FolioVision’s post. Your plugin was to me one of the best WordPress plugins – I’ve recommended it to every WordPress-based website I’ve worked with, and installed it myself in dozens of websites I’ve been involved with, small or big.

    I now find myself having to write various functions to overcome a host of issues – not all yet solved for me – since upgrading the plugin. Preload is extremely buggy – I don’t understand why, but it continues to delete itself and rebuild (even though that option is disabled), sending me dozens of error emails. Garbage collection most certainly does not work as it did – I wrote functions to sort out the issues it caused. And I am seriously shaking with fear in the thought of upgrading the next time there’s a new version, because the impact of WPSC not working on a website with 1 million pageviews a day and over 10,000 articles can be detrimental.

    I remind myself all the time that this is a free plugin. Though I will pay for it if it were not. But I urge you, as Alec stated, to keep it working and keep it working out of the box. Please don’t stray from its original simplicity and beauty.

    Many thanks,

    Bira

    FolioVision, Biranit – the plugin works out of the box for me and most people. I wouldn’t ship something that I knew was broken but there are so many types of hosting that it’s impossible to test every combination of plugins, operating system, Apache versions and whatever else.

    Have you tried going back to a version that works for you? If you’re getting error messages, can you check the plugin for those error messages and attempt to figure out why it’s not working? Send me a patch or even describe where in the code you think it’s wrong. That would be really helpful.

    I have hardly any time to devote to this any more. One of the dangers of becoming a father I’m afraid.

Viewing 15 replies - 1 through 15 (of 22 total)
  • The topic ‘[Plugin: WP Super Cache] Homepage not refreshing – Garbage Collection problem’ is closed to new replies.