Page MenuHomePhabricator

WinCache Bug - Keys (e.g. Headings) with more than 150 characters
Closed, ResolvedPublic

Description

WinCache has a limit to the key size of 150 characters. Among other things, wincache_lock crashes on a longer key because of limits to the length of a Windows Mutex.

A stack trace of this issue looks like this:

PHP Fatal error:  wincache_lock(): lock key should be less than 150 characters in .\includes\libs\objectcache\WinCacheBagOStuff.php on line 55

PHP Stack trace:

PHP   1. {main}() .\index.php:0
PHP   2. MediaWiki->run() .\index.php:42
PHP   3. MediaWiki->main() .\includes\MediaWiki.php:524
PHP   4. MediaWiki->performRequest() .\includes\MediaWiki.php:861
PHP   5. MediaWiki->performAction() .\includes\MediaWiki.php:294
PHP   6. ViewAction->show() .\includes\MediaWiki.php:500
PHP   7. Article->view() .\includes\actions\ViewAction.php:68
PHP   8. PoolWorkArticleView->execute() .\includes\page\Article.php:604
PHP   9. PoolWorkArticleView->doWork() .\includes\poolcounter\PoolCounterWork.php:123
PHP  10. WikitextContent->getParserOutput() .\includes\poolcounter\PoolWorkArticleView.php:144
PHP  11. WikitextContent->fillParserOutput() .\includes\content\AbstractContent.php:516
PHP  12. Parser->parse() .\includes\content\WikitextContent.php:323
PHP  13. Parser->internalParse() .\includes\parser\Parser.php:443
PHP  14. Parser->formatHeadings() .\includes\parser\Parser.php:1327
PHP  15. Parser::normalizeSectionName() .\includes\parser\Parser.php:4245
PHP  16. MediaWikiTitleCodec->splitTitleString() .\includes\parser\Parser.php:5867
PHP  17. MediaWiki\Interwiki\ClassicInterwikiLookup->isValidInterwiki() .\includes\title\MediaWikiTitleCodec.php:334
PHP  18. MediaWiki\Interwiki\ClassicInterwikiLookup->fetch() .\includes\interwiki\ClassicInterwikiLookup.php:131
PHP  19. MediaWiki\Interwiki\ClassicInterwikiLookup->load() .\includes\interwiki\ClassicInterwikiLookup.php:155
PHP  20. WANObjectCache->getWithSetCallback() .\includes\interwiki\ClassicInterwikiLookup.php:298
PHP  21. WANObjectCache->doGetWithSetCallback() .\includes\libs\objectcache\WANObjectCache.php:1114
PHP  22. WANObjectCache->set() .\includes\libs\objectcache\WANObjectCache.php:1262
PHP  23. WinCacheBagOStuff->merge() .\includes\libs\objectcache\WANObjectCache.php:546
PHP  24. wincache_lock() .\includes\libs\objectcache\WinCacheBagOStuff.php:55

Proposed Fix
Run the object cache keys through a fixed-length digest (going to try MD5 at first) before querying WinCache.

Event Timeline

Change 476987 had a related patch set uploaded (by Juan Osorio (Microsoft); owner: Juan Osorio (Microsoft)):
[mediawiki/core@master] Fixes WinCache keys longer than 150 chars.

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

Change 476987 merged by jenkins-bot:
[mediawiki/core@master] objectcache: Fix WinCache keys longer than 150 chars

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