Page MenuHomePhabricator

CacheDecorator does not work when AND filtering is enabled
Closed, ResolvedPublic

Description

On visits to Special:Homepage, CacheDecorator is supposed to fetch a cached taskset list (a JSON representation of the TaskSet class). If the cache is expired or the filters don't match what is stored in the cache, then a new cache item should be generated by calling ElasticSearch (which is slow).

Update: @Urbanecm_WMF noticed this has to do with AND topic filtering enabled.


This seems to work on all the wikis I've looked at except for cswiki, where I see "CacheDecorator miss" (logs) on each page view when using the WikimediaDebug extension with verbose logging. I can also verify that by looking at the XHGui report for Special:Homepage on cswiki (XHGui report) where we can see that CacheDecorator::suggest is consistently in the several hundred ms range; compare to enwiki where fetching from cache takes about 10ms.

I haven't been able to reproduce the issue on eswiki, arwiki, enwiki, or frwiki.

Event Timeline

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

Despite this initially seeming to be deterministic, I was able to get a read from the cache once. Still, there are a dozen or more other attempts that are failing, so we should try to figure out why.

I can't reproduce this at Czech Wikipedia. I tried to make a handful of different requests to my homepage, and no matter what I do, I always get at most one miss per "type of requests" (same task types/topic selection/etc).

@kostajh Is this still reproducible for you? If so, it might be caused by some of your account's settings (which would also explain why you only see it for cswiki and not for other wikis).

I can't reproduce this at Czech Wikipedia. I tried to make a handful of different requests to my homepage, and no matter what I do, I always get at most one miss per "type of requests" (same task types/topic selection/etc).

@kostajh Is this still reproducible for you? If so, it might be caused by some of your account's settings (which would also explain why you only see it for cswiki and not for other wikis).

Hmm. Yes, it's still happening for me, two requests made just now: https://performance.wikimedia.org/xhgui/run/symbol?id=6282324aafcbceb4d51bb6d5&symbol=GrowthExperiments%5CNewcomerTasks%5CTaskSuggester%5CCacheDecorator%3A%3Asuggest and https://performance.wikimedia.org/xhgui/run/symbol?id=62823229ff638875619de9c6&symbol=GrowthExperiments%5CNewcomerTasks%5CTaskSuggester%5CCacheDecorator%3A%3Asuggest

Thanks Kosta, that was helpful. I checked your account's preferences and played with the interface for a while. It seems the issue is triggered when topic filters include topics that are not recognized and the filtering mode is AND.

I am able to reproduce the issue by running the following two console commands:

new mw.Api().saveOption('growthexperiments-homepage-se-topic-filters', '["foo","bar"]')
new mw.Api().saveOption('growthexperiments-homepage-se-topic-filters-mode', 'AND')

I successfully reproduced the issue on both my primary WMF account and a single-purpose testing account (MU test 202205161331‬). @kostajh I'm not sure how the topic filtering works internally – is it possible that unrecognized topics cause this sort of weird behavior? Interestingly, I can't reproduce it without setting my mode to AND.

Thanks Kosta, that was helpful. I checked your account's preferences and played with the interface for a while. It seems the issue is triggered when topic filters include topics that are not recognized and the filtering mode is AND.

I am able to reproduce the issue by running the following two console commands:

new mw.Api().saveOption('growthexperiments-homepage-se-topic-filters', '["foo","bar"]')
new mw.Api().saveOption('growthexperiments-homepage-se-topic-filters-mode', 'AND')

I successfully reproduced the issue on both my primary WMF account and a single-purpose testing account (MU test 202205161331‬). @kostajh I'm not sure how the topic filtering works internally – is it possible that unrecognized topics cause this sort of weird behavior? Interestingly, I can't reproduce it without setting my mode to AND.

Hmm, interesting. In my case, my topics are known ("[\"science\",\"geography\"]") but I can see how unknown topics could affect what gets saved in the cached task set, and how the saved settings wouldn't match the cached task set. Maybe we should prevent invalid topics (and task types) from getting saved to the user options?

The culprit is probably the "AND" mode, I'll see if I can track it down from there.

kostajh renamed this task from CacheDecorator seems to not work on cswiki to CacheDecorator does not work when AND filtering is enabled.May 16 2022, 12:30 PM
kostajh claimed this task.
kostajh triaged this task as Medium priority.
kostajh updated the task description. (Show Details)

Change 792199 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[mediawiki/extensions/GrowthExperiments@master] GrowthTasksApi: Set topics match mode in API params separately from topics

https://gerrit.wikimedia.org/r/792199

Change 792199 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] GrowthTasksApi: Set topics match mode in API params separately from topics

https://gerrit.wikimedia.org/r/792199