Page MenuHomePhabricator

L10n cache is completely broken
Closed, ResolvedPublic


Manual localisation cache rebuild is failing with:

Query: INSERT  INTO `bw_l10n_cache` ......
Error: 1062 Duplicate entry 'mr-messages:apihelp-query+allusers-example-y' for key 'PRIMARY' (

Language codes seen: mr and tl. It shouldn't even be using the database!

While trying to access the wiki from web I see:

Warning: dba_open(/l10n_cache-en.cdb.tmp.459236192): failed to open stream: Permission denied in /www/ on line 39
[20897a16ed55e7907b3edc15] /w/i.php?title=Special:ContentTranslation&page=Moshing&from=en&to=es&targettitle=Moshing&debug=true MWException from line 98 of /www/ Unable to open CDB file for write "/l10n_cache-en.cdb"


#0 /www/ LCStoreCDB->startWrite(string)
#1 /www/ LocalisationCache->recache(string)
#2 /www/ LocalisationCache->initLanguage(string)
#3 /www/ LocalisationCache->loadItem(string, string)
#4 /www/ LocalisationCache->loadSubitem(string, string, string)
#5 /www/ LocalisationCache->getSubitem(string, string, string)
#6 /www/ LocalisationCache->getSubitemList(string, string)
#7 /www/ Language::getMessageKeysFor(string)
#8 /www/ MessageCache->load(string)
#9 /www/ MessageCache->getMsgFromNamespace(string, string)
#10 /www/ MessageCache->getMessageForLang(LanguageEn, string, boolean, array)
#11 /www/ MessageCache->getMessageFromFallbackChain(LanguageEn, string, boolean)
#12 /www/ MessageCache->get(string, boolean, LanguageEn)
#13 /www/ Message->fetchMessage()
#14 /www/ Message->isDisabled()
#15 /www/ CirrusSearch\Hooks::CirrusSearch\{closure}(integer)
#16 /www/ BagOStuff->getWithSetCallback(string, integer, Closure)
#17 /www/ CirrusSearch\Hooks::overrideMoreLikeThisOptionsFromMessage()
#18 /www/ CirrusSearch\Hooks::initializeForRequest(WebRequest)
#19 /www/ CirrusSearch\Hooks::onBeforeInitialize(Title, NULL, OutputPage, User, WebRequest, MediaWiki)
#20 /www/ Hooks::callHook(string, array, array, NULL)
#21 /www/ Hooks::run(string, array)
#22 /www/ MediaWiki->performRequest()
#23 /www/ MediaWiki->main()
#24 /www/ MediaWiki->run()
#25 {main}

It's trying to read CDB files from root!

My config:

$wgLocalisationCacheConf['store'] = 'files';
$wgLocalisationCacheConf['manualRecache'] = false;

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptAug 26 2019, 8:20 AM
Nikerabbit triaged this task as Unbreak Now! priority.Aug 26 2019, 8:30 AM
Nikerabbit added subscribers: Simetrical, daniel.

Git bisect points to rMWe4468a1d6b6b: Make LocalisationCache a service. Setting UBN! for attention. I feel this doesn't affect everyone, though, or it would have been noticed already.

Restricted Application added a subscriber: Liuxinyu970226. · View Herald TranscriptAug 26 2019, 8:30 AM

Does not revert cleanly. Only workaround seems to be to roll back to commit before it.

You need to revert LanguageNameUtils too, then it works fine (other than RELEASE-NOTES conflicts, obviously): 2e52f48c2ed

Obviously someone should revert immediately. Then I want to figure out what's going on with the failures -- this patch was from before I tried to get 100% test coverage before refactoring anything.

I think I see the problem:

+        $storeArg['directory'] =
+            $conf['storeDirectory'] ?? $services->getMainConfig()->get( 'CacheDirectory' );


-        $directory = !empty( $conf['storeDirectory'] ) ? $conf['storeDirectory'] : $wgCacheDirectory;

That needs to be ?:, not ??. I'll post a fix in a second.

Change 532343 had a related patch set uploaded (by simetrical; owner: simetrical):
[mediawiki/core@master] Correctly register storeDirectory in l10n cache

The breakage of rebuildLocalisationCache.php is an entirely separate problem. Separate patch coming for that. See, this is why tests before refactoring is a good idea!

So those two patches should fix the two issues that you ran into. I leave it up to the people with +2 access to decide whether it's wise to just commit these two fixes or to revert LocalisationCache and LanguageNameUtils for now.

Change 532346 had a related patch set uploaded (by simetrical; owner: simetrical):
[mediawiki/core@master] Pass correct store to rebuildLocalisationCache.php

Change 532343 merged by jenkins-bot:
[mediawiki/core@master] Correctly register storeDirectory in l10n cache

Change 532346 merged by jenkins-bot:
[mediawiki/core@master] Pass correct store to rebuildLocalisationCache.php

This should be fixed now, can you test?

(Not related or affecting at the moment).

No directly observable errors seen now.

Then I think it's resolved, although the patch is being backed out anyway for now because of T231198/T231200.

Friendly reminder, this is blocking the train. Will it be resolved by train window tomorrow?

Tarrow added a subscriber: Tarrow.Aug 26 2019, 7:43 PM
Simetrical closed this task as Resolved.Aug 27 2019, 7:15 AM
Simetrical claimed this task.