Page MenuHomePhabricator

Browser cache never used for logged in users when $wgMainCacheType is CACHE_NONE
Open, LowPublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

  • Set $wgMainCacheType to CACHE_NONE
  • Be logged in

What happens?:

Pages are served with HTTP 200 instead of 304 even though If-Modified-Since header is present and the article has not been modified.

What should have happened instead?:
When there have been no changes since If-Modified-Since header, return 304 status code.

Deleting this line fixes the issue for me:
https://github.com/wikimedia/mediawiki/blob/8d2be7706dbd8e1f5ad08c9c9189be7e893088d4/includes/user/User.php#L2302

I believe the reason is that $mQuickTouched is always the current time when using CACHE_NONE (I don't fully understand why), so the correct value in $mTouched is never used.

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc:
MediaWiki 1.36.2

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

\cc @tstarling

We talked about this today and I mentioned remembering that there was an issue with this churning the cache on plain installs, and that I was wondering at the time whether we still needed this additional layer.

In context of change 771762, the answer is yes we do still have a use for quick touch, which is to specifically avoid 304 responses when the user has recently recieved a notification. For that purpose, the lightweight memcached layer is ideally suited.

Having said that, I do think we can probably improve this to not blindly initialise User::mQuickTouched for every user on every page view. Perhaps we can make it smarter and give it a bottom value as default that we don't need to store but still consider into HTTP revalidation, and then only set/bump it when needed, which should still have the same effect.