Last modified: 2009-11-12 22:13:44 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T21391, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 19391 - The feed on Special:RecentChanges is cached in random language
The feed on Special:RecentChanges is cached in random language
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Recent changes (Other open bugs)
unspecified
All All
: Normal minor with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
http://ab.wiktionary.org/w/index.php?...
: patch, patch-need-review
Depends on:
Blocks: feeds 19055
  Show dependency treegraph
 
Reported: 2009-06-25 14:15 UTC by Mormegil
Modified: 2009-11-12 22:13 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Include language in the cache key (807 bytes, patch)
2009-06-25 14:15 UTC, Mormegil
Details
Use expiration not only for the timestamp, but also for the feed data (482 bytes, patch)
2009-06-27 18:33 UTC, Mormegil
Details

Description Mormegil 2009-06-25 14:15:12 UTC
Created attachment 6265 [details]
Include language in the cache key

The feed for recent changes is cached (for at least $wgFeedCacheTimeout seconds). The cache key considers limit, hideminor (and target), and the code prevents tries to prevent other options from having effect (stating “Feed is cached on limit,hideminor; other params would randomly not work”).

However, the user language, and the uselang query parameter still have effect. That means that the feed gets cached in the preferred language of the user who triggered its rendering, and that language is served to all users during the cache timeout period. (Check e.g. http://ab.wiktionary.org/w/index.php?title=Special:RecentChanges&feed=rss&uselang=ru and immediately afterwards just http://ab.wiktionary.org/w/index.php?title=Special:RecentChanges&feed=rss)

There are, in principle, two ways of solving this bug: 1. Fix the feed so that is always generated in the content language, no matter what the user wants. 2. Change the caching key to include the language.

The first option would not only be user-unfriendly (see also bug #17868), it would also be quite difficult to achieve. Not only does the preferred language affect the feed format, it also affects contents of displayed log events, etc.

Since the second option is also easy to implement, so I am providing a simple patch.
Comment 1 Laurence 'GreenReaper' Parry 2009-06-26 22:58:24 UTC
The recent changes feed is from 100-250kb (arguably another issue) and is cached forever. Are you suggesting that we should add one for every language that may be used by visitors? This could eat up cache pretty quickly.
Comment 2 Mormegil 2009-06-27 18:31:49 UTC
When I looked at the source, I was surprised to see that, indeed, the cached RC feed data does not expire. I believe this is just a plain bug: the feed data should expire after 24 h, just like its timestamp does (adding a patch in a while).

So, assuming this gets fixed, the feed is cached only for languages somebody requested, and only for at most 24 h.

If that does not look acceptable to you, we are left with only the other option I mentioned: force content language always. But, that means saying “no” to the users requesting otherwise (see that bug #17868), and is not completely trivial – you will probably need to set wgLang to wgContLang during feed rendering (or refactor at least FeedUtils::formatDiff (and possibly other places) to explicitly pass the language to use; (mmm… that $wgUser->getSkin() seems interesting, too…).

Oh, in fact, we do have yet another option: keep the functionality as it is, only if wgLang!=wgContLang, do not cache the feed. But that would be a possibility to a DOS attack or something like that. (Or, we could use much shorter cache timeouts for those languages.)
Comment 3 Mormegil 2009-06-27 18:33:18 UTC
Created attachment 6278 [details]
Use expiration not only for the timestamp, but also for the feed data

Currently, the feed timestamp stored in the cache expires in 24 hours, but the feed data does not expire at all, which is nonsense, since the data is used only if the timestamp is found in the cache.
Comment 4 Dan Jacobson 2009-07-18 19:24:13 UTC
In bug 19812#c1 you see me "go pick some odd limit" to workaround. Yuck,
Comment 5 Bryan Tong Minh 2009-11-12 22:13:44 UTC
Applied in r58978.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links