Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: frontpage cache is often lost #25566

Open
dima-stefantsov opened this issue Sep 21, 2016 · 17 comments
Open

BUG: frontpage cache is often lost #25566

dima-stefantsov opened this issue Sep 21, 2016 · 17 comments
Labels
[Plugin] Super Cache A fast caching plugin for WordPress. [Pri] Low [Status] Auto-allocated [Super Cache] Configuration Configuration settings [Super Cache] Preload [Type] Bug When a feature is broken and / or not performing as intended

Comments

@dima-stefantsov
Copy link

I've had this bug on different sites for a long time. Now my situation was dire enough (~30 sec per page render) to force me debug it.

Bug: frontpage cache is lost, forcing re-render often.

How to reproduce: disable cache timeout (doesn't matter, just for convenience), enable preload mode with no cache expiration. Enable cache rebuild (important).

Make some or all pages... Mobile github lost my report text. In short words, cache it, invoke cron, frontpage cache lost.

Wrong logic in marking 'to remove dir'.

Please fix.

@Sophist-UK
Copy link
Contributor

See Automattic/wp-super-cache#98 for my analysis of the whole cache invalidation issue.

@dima-stefantsov
Copy link
Author

It is not connected, except for general idea "wow, this code is bad".

@dima-stefantsov
Copy link
Author

#25581 same issue. Wow, it's exact location is reported in 2015. Still no fix. Looks like will have to edit inline, disable updates.

@Sophist-UK
Copy link
Contributor

There are actually several longstanding issues about cache invalidation.

Considering that this plugin is authored by the developers of Wordpress, you might think that support would be somewhat better.

@dima-stefantsov
Copy link
Author

Unlike other plugins like WPFC, WPSC actually works. In many cases. This is good enough already.
Editing it inline will work for few things that need to be fixed for my case.

If you have advice what caching plugin will work at least as good as WPSC, but also have good code, I'd love to hear it.

@peterbowey
Copy link

I have also experienced this front page cache loss / drop on different sites for a while via WPFC. If the site is accessed enough the cache logic seems to hold, then drops later. It has bearing on a static front page along with cache logic firing a drop. Still a great tool in WPFC

@marcomarsala
Copy link

marcomarsala commented Oct 14, 2016

Seems enabling direct cache files for home page (/) solves the issue.

But another different issue arises: #25558

@javorszky
Copy link

javorszky commented Feb 20, 2017

Ran into this bug myself as well. The debug log tells me that the supercache is not found for the home page, but prior to refreshing the page, I'm staring at the file on the FTP server (refreshed, in case it was an FTP cache issue).

So something clears the file before WPSC wants to look for it.

Other pages cache normally from the few I randomly checked.

Currently trying to reproduce this on a local site. I'll post findings if I have news.

@donnchawp
Copy link
Contributor

@javorszky - give the code here on master a spin. I'm running it on my blogs and I fixed and merged the issue with the front page in Automattic/wp-super-cache#175.

@javorszky
Copy link

@donnchawp not sure that applies, as the front page is latest posts, not static page, and I'm not updating any content between refreshes / cache clears.

@javorszky
Copy link

Managed to reproduce the bug locally. Tried it with both master and 1.4.9 on wp.org repo (btw you don't have a 1.4.9 version tagged on Github).

It's caused by the slash check. With the slash check on, the front page would never stay in cache. With it off, front page is cached as well.

$wp_cache_slash_check = 1; //Added by WP-Cache Manager is causing the headache.

@javorszky
Copy link

Though I may have spoken too soon... sigh, further investigation is needed, bear with me. I might be running into different issues.

@javorszky
Copy link

Okay, I'm not going mad. If slash check is set to 1, it works. However running a cache check resets it to be 0.

@javorszky
Copy link

javorszky commented Feb 20, 2017

Which... is because it looks at the permalink structure, whether the last character of the permalink is a slash or not. Which causes problems on the index page, as that's, from what I can tell, will always be /, so the last character of that uri is guaranteed to be /.

Even if the permalink structure is set to be http://sitename.com/%post_id% (note the missing slash at the end of it).

In the majority of sites I've seen that's not a problem because the request uri and the home uri are the same.

Unless, of course, the site is in a subdirectory, so the siteurl has a subdir on, the home doesn't, which means that in the code right here

  1. home uri and request uri are not the same, so this part evaluates to false
  2. slash check is 0 because the last character of the permalink structure is not a /, so the second part evaluates to false
  3. slash check is 0, but the last character of the uri is actually a /, so this is false too

Which means that the home page is guaranteed to drop the cache every time.

@marcomarsala
Copy link

marcomarsala commented Feb 21, 2017 via email

@talgalili
Copy link

Could this issue be related to this:
#25563
?

@JJJ
Copy link
Contributor

JJJ commented Feb 21, 2017

Unless I'm misunderstanding, I can't see any good that would come from slashed/unslashed URLs being treated uniquely, and the software should be smart enough to guess this based on environment variables without user intervention.

At a glance, the current slash/no-slash logic seems overly complex.

Can we run the requested URL through user_trailingslashit(), or just always use the unslashed version of the URL everywhere by passing it through untrailingslashit()?

@kraftbj kraftbj added the [Plugin] Super Cache A fast caching plugin for WordPress. label Aug 12, 2022
@kraftbj kraftbj transferred this issue from Automattic/wp-super-cache Aug 12, 2022
@jeherve jeherve added [Type] Bug When a feature is broken and / or not performing as intended [Super Cache] Configuration Configuration settings [Super Cache] Preload labels Aug 15, 2022
@Robertght Robertght moved this from Needs Triage to Triaged in Automattic Prioritization: The One Board ™ Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Plugin] Super Cache A fast caching plugin for WordPress. [Pri] Low [Status] Auto-allocated [Super Cache] Configuration Configuration settings [Super Cache] Preload [Type] Bug When a feature is broken and / or not performing as intended
Projects
Development

No branches or pull requests