On Tue, Nov 9, 2010 at 10:38 AM, Benjamin Lees <[email protected]> wrote: > Current versions of MediaWiki (1.16+) will actually check the memory > limit on every pageview and raise it if it's below 50MB, by default. > (The installer used to add an ini_set line in LocalSettings.php; see > http://www.mediawiki.org/wiki/Manual:$wgMemoryLimit ). There > shouldn't be any need to futz with it. > > What exactly leads you to suspect pcre.backtrack_limit is causing > problems? Do you have a huge regex that's being silently ignored, or > are you getting an error?
I don't know where to look for errors about this. Is there is a log, maybe a PHP log, that would record when a $wgSpamRegex runs out of memory? Here's the evidence I have that it might be running out of memory: With 'pcre.backtrack_limit' at default (not set in LocalSettings.php, and 'memory_limit' not set either) a clumsy regex like this one (meant to match external links not separated by at least two words), $wgSpamRegex = "/http:\/\/\S*\s*\S*\s*\S*\s*\S*http:\/\/\S*/i"; ..fails to match any of the following wiki edit field text: ==Banana== [http://link.link.banababot.com/linkety-link:Linkety-plonk-1 Link-1] b a n a n a [http://link.link.banababot.com/linkety-link:Linkety-plonk-2 Link-2] [http://link.link.banababot.com/linkety-link:Linkety-plonk-3 Link-3] ..However, it match links 2 and 3 when they are on top, as in this edit text: ==Banana== [http://link.link.banababot.com/linkety-link:Linkety-plonk-2 Link-2] [http://link.link.banababot.com/linkety-link:Linkety-plonk-3 Link-3] [http://link.link.banababot.com/linkety-link:Linkety-plonk-1 Link-1] b a n a n a Links 2 and 3 should match whether or not link 1 is above them. If I set 'pcre.backtrack_limit' to 8M, or even 2M, then the regex successfully matches links 1 and 2 in both texts above, as intended. With 'pcre.backtrack_limit' at its default setting, not set in LocalSettings.php, the regex fails to match the first text above. I think it runs out of memory because it is a _clumsy_ regex. Where might I look for a log of it failing or running out of memory? The following regex is _better formed_, I think, and successfully matches both above texts with or without a 'pcre.backtrack_limit' setting in LocalSettings.php: $wgSpamRegex = "http:\/\/(\S+\s+){1,3}\S*http:\/\/\S+|"/i; # Matches 2 external links with less than " x.. x.. " between them I did the above tests by editing LocalSettings.php and then trying test edits in my wiki. What is the relationship and precedence between PHP's 'pcre.backtrack_limit' and 'memory_limit' settings? Thanks for your help! Roger --Wikigogy.org MediaWiki 1.16.0 PHP 5.2.14 (litespeed) MySQL 5.0.91-community-log _______________________________________________ MediaWiki-l mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
