Page MenuHomePhabricator

Exception: Key contains invalid characters
Closed, ResolvedPublicPRODUCTION ERROR

Description

2017-03-07 00:11:31 [WL36swpAANEAAHQLhF0AAACX] mw1206 enwiki 1.29.0-wmf.14 exception ERROR: [WL36swpAANEAAHQLhF0AAACX] /w/api.php?format=json&formatversion=2&action=jsondata&title=Sandbox/%D0%90%D0%BB%D1%8B%D0%B9_%D0%9A%D0%BE%D1%80%D0%BE%D0%BB%D1%8C/Example.tab&uselang=en   Exception from line 156 of /srv/mediawiki/php-1.29.0-wmf.14/includes/libs/objectcache/MemcachedBagOStuff.php: Key contains invalid characters: JsonConfig:1::F:486:Sandbox/Алый_Король/Example.tab {"exception_id":"WL36swpAANEAAHQLhF0AAACX","caught_by":"other"}
[Exception Exception] (/srv/mediawiki/php-1.29.0-wmf.14/includes/libs/objectcache/MemcachedBagOStuff.php:156) Key contains invalid characters: JsonConfig:1::F:486:Sandbox/Алый_Король/Example.tab
  #0 /srv/mediawiki/php-1.29.0-wmf.14/includes/libs/objectcache/MemcachedPeclBagOStuff.php(145): MemcachedBagOStuff->validateKeyEncoding(string)
  #1 /srv/mediawiki/php-1.29.0-wmf.14/includes/libs/objectcache/MemcachedBagOStuff.php(56): MemcachedPeclBagOStuff->getWithToken(string, NULL, integer)
  #2 /srv/mediawiki/php-1.29.0-wmf.14/includes/libs/objectcache/BagOStuff.php(185): MemcachedBagOStuff->doGet(string, integer)
  #3 /srv/mediawiki/php-1.29.0-wmf.14/extensions/JsonConfig/includes/JCCache.php(79): BagOStuff->get(string)
  #4 /srv/mediawiki/php-1.29.0-wmf.14/extensions/JsonConfig/includes/JCCache.php(54): JsonConfig\JCCache->memcGet()
  #5 /srv/mediawiki/php-1.29.0-wmf.14/extensions/JsonConfig/includes/JCSingleton.php(345): JsonConfig\JCCache->get()
  #6 /srv/mediawiki/php-1.29.0-wmf.14/extensions/JsonConfig/includes/JCDataApi.php(25): JsonConfig\JCSingleton::getContent(JsonConfig\JCTitle)
  #7 /srv/mediawiki/php-1.29.0-wmf.14/includes/api/ApiMain.php(1542): JsonConfig\JCDataApi->execute()
  #8 /srv/mediawiki/php-1.29.0-wmf.14/includes/api/ApiMain.php(543): ApiMain->executeAction()
  #9 /srv/mediawiki/php-1.29.0-wmf.14/includes/api/ApiMain.php(514): ApiMain->executeActionWithErrorHandling()
  #10 /srv/mediawiki/php-1.29.0-wmf.14/api.php(83): ApiMain->execute()
  #11 /srv/mediawiki/w/api.php(3): include(string)
  #12 {main}

Event Timeline

Change 341495 had a related patch set uploaded (by legoktm):
[mediawiki/extensions/JsonConfig] Avoid invalid characters in memcache keys

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

Change 341495 merged by jenkins-bot:
[mediawiki/extensions/JsonConfig] Avoid invalid characters in memcache keys

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

Change 341495 had a related patch set uploaded (by legoktm):
[mediawiki/extensions/JsonConfig] Avoid invalid characters in memcache keys

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

The problem wasn't whether the input for the key was too long or contained bad characters, that's what makeKey() and makeGlobalKey() are for. The problem is that this code wasn't always calling wfMemcKey (or wfGlobalCacheKey).

MemcachedBagOStuff::makeKey automatically ensures any too long or illegal segments are encoded or hashed accordingly.

It looks like modified code should have an else branch to call wfGlobalCacheKey(). Right now the non-local case is passing right through, which is unsupported. All keys must be created by makeKey().

Change 347139 had a related patch set uploaded (by Legoktm):
[mediawiki/extensions/JsonConfig@master] Make sure cache key always goes through makeKey*()

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

Change 347139 merged by jenkins-bot:
[mediawiki/extensions/JsonConfig@master] Make sure cache key always goes through makeKey*()

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

mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:10 PM