From: Ori Livneh Date: Thu, 3 Sep 2015 00:24:33 +0000 (-0700) Subject: Decline to cache preprocessor items larger than 1 Mb X-Git-Tag: 1.31.0-rc.0~10161^2 X-Git-Url: http://git.cyclocoop.org/%24self?a=commitdiff_plain;h=4595e34ff111b36a3d7716cfb1935bed4f90d0af;p=lhc%2Fweb%2Fwiklou.git Decline to cache preprocessor items larger than 1 Mb This is a temporarily workaround for T111289. The data ought not be so large, but it frequently is, and the problem is almost exclusive to this code path. For now, just avoid attempting to cache the value if its size exceeds a million bytes. Bug: T111289 Change-Id: Idd1acd903193f0753cc5548bd32800705716dd9f --- diff --git a/includes/parser/Preprocessor_Hash.php b/includes/parser/Preprocessor_Hash.php index 8ddb401f7a..9429e442e7 100644 --- a/includes/parser/Preprocessor_Hash.php +++ b/includes/parser/Preprocessor_Hash.php @@ -734,8 +734,12 @@ class Preprocessor_Hash implements Preprocessor { // Cache if ( $cacheable ) { $cacheValue = sprintf( "%08d", self::CACHE_VERSION ) . serialize( $rootNode ); - $wgMemc->set( $cacheKey, $cacheValue, 86400 ); - wfDebugLog( "Preprocessor", "Saved preprocessor Hash to memcached (key $cacheKey)" ); + + // T111289: Cache values should not exceed 1 Mb, but they do. + if ( strlen( $cacheValue ) <= 1e6 ) { + $wgMemc->set( $cacheKey, $cacheValue, 86400 ); + wfDebugLog( "Preprocessor", "Saved preprocessor Hash to memcached (key $cacheKey)" ); + } } return $rootNode;