Page MenuHomePhabricator

Increase $wgAbuseFilterConditionLimit
Closed, ResolvedPublic

Description

By default it's set to 1000, and to 2000 for commons. The condition limit is not a good performance metric: a filter with 1000 simple conditions (e.g. foo === bar) is much faster than a filter consuming a single condition for a badly optimized regex (e.g., if there's catastrophic backtracking). Ideally we would replace the condition limit with a time-based limit (see e.g. r80159), but that's not trivial: we won't be able to interrupt built-in PHP functions (e.g. preg_match, which is responsible for a lot of the slowness) unless we use excimer (but that's only for linux, so we'd need a fallback for other OSs) or declare(ticks=...) (which impacts the performance).

So until we can do better, I propose to increase the condition limit to 2000 by default. This is also motivated by the fact that the condition limit is actually reached on some Wikimedia projects: this seems to be the case for large wikis with global filters enabled (frwiki and ptwiki), as well as wikis whose filters consume many conditions (zhwiki). This is especially important if we want to enable global filters everywhere.

Event Timeline

Change 901289 had a related patch set uploaded (by Samtar; author: Samtar):

[operations/mediawiki-config@master] wgAbuseFilterConditionLimit: Set default condition limit to 2000

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

Change 901289 merged by jenkins-bot:

[operations/mediawiki-config@master] wgAbuseFilterConditionLimit: Set default condition limit to 2000

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

Mentioned in SAL (#wikimedia-operations) [2023-03-21T15:00:39Z] <samtar@deploy2002> Started scap: Backport for [[gerrit:901289|wgAbuseFilterConditionLimit: Set default condition limit to 2000 (T309609)]]

Mentioned in SAL (#wikimedia-operations) [2023-03-21T15:02:16Z] <samtar@deploy2002> samtar: Backport for [[gerrit:901289|wgAbuseFilterConditionLimit: Set default condition limit to 2000 (T309609)]] synced to the testservers: mwdebug2001.codfw.wmnet, mwdebug1001.eqiad.wmnet, mwdebug1002.eqiad.wmnet, mwdebug2002.codfw.wmnet

Should this go in Tech News?

I had the same thought — I suppose a quick line in "Recent changes" wouldn't hurt?

Mentioned in SAL (#wikimedia-operations) [2023-03-21T15:10:12Z] <samtar@deploy2002> Finished scap: Backport for [[gerrit:901289|wgAbuseFilterConditionLimit: Set default condition limit to 2000 (T309609)]] (duration: 09m 32s)

Should this go in Tech News?

I had the same thought — I suppose a quick line in "Recent changes" wouldn't hurt?

Agreed, mostly so that people can update local documentation etc.

TheresNoTime claimed this task.

Should this go in Tech News?

I had the same thought — I suppose a quick line in "Recent changes" wouldn't hurt?

Agreed, mostly so that people can update local documentation etc.

Done :-)