Page MenuHomePhabricator

Install from scratch stops with error 1146 "Table 'l10n_cache' does not exist"
Open, HighPublic

Description

When installing MW 1.35-rc2 from scratch (no tables in database), the installation stops with error 1146:

Setting up database... done
Creating tables, step one... 

[X0K4cLHhKkd8BQVmPFrEtAAAAE8] /w/mw-config/index.php?page=Install Wikimedia\Rdbms\DBQueryError from line 1699 of /home/otelriuj/domainname.org/w/includes/libs/rdbms/database/Database.php: A database query error has occurred. Did you forget to run your application's database schema updater after upgrading?

Error 1146: Table 'otelriuj_topools.l10n_cache' doesn't exist (localhost)
Function: LCStoreDB::get
Query: SELECT lc_value FROM `l10n_cache` WHERE lc_lang = 'sv' AND lc_key = 'deps' LIMIT 1

Error is reproducible with install settings:

Your language: en - English
Wiki language: sv - Swedish

If both langugages are set to English, the error does not appear.

When checking the database, only four tables have been created: actor, site_identifiers, updatelog and user_format_groups.

If I first install MW-1.34.2 from scratch tables are created as expected in database. It is then possible to install 1.35.rc2 which detects existing tables and the installation proceeds with success.

System is a shared host with:

  • PHP: 7.4.9 (litespeed)
  • MariaDB: 10.3.23-MariaDB-log-cll-lve

See backtrace below (domain name changed for privacy):

#0 /home/otelriuj/domainname.org/w/includes/libs/rdbms/database/Database.php(1683): Wikimedia\Rdbms\Database->getQueryException(string, integer, string, string)
#1 /home/otelriuj/domainname.org/w/includes/libs/rdbms/database/Database.php(1658): Wikimedia\Rdbms\Database->getQueryExceptionAndLog(string, integer, string, string)
#2 /home/otelriuj/domainname.org/w/includes/libs/rdbms/database/Database.php(1227): Wikimedia\Rdbms\Database->reportQueryError(string, integer, string, string, boolean)
#3 /home/otelriuj/domainname.org/w/includes/libs/rdbms/database/Database.php(1907): Wikimedia\Rdbms\Database->query(string, string, integer)
#4 /home/otelriuj/domainname.org/w/includes/libs/rdbms/database/Database.php(1746): Wikimedia\Rdbms\Database->select(string, string, array, string, array, array)
#5 /home/otelriuj/domainname.org/w/includes/libs/rdbms/database/DBConnRef.php(68): Wikimedia\Rdbms\Database->selectField(string, string, array, string)
#6 /home/otelriuj/domainname.org/w/includes/libs/rdbms/database/DBConnRef.php(300): Wikimedia\Rdbms\DBConnRef->__call(string, array)
#7 /home/otelriuj/domainname.org/w/includes/cache/localisation/LCStoreDB.php(63): Wikimedia\Rdbms\DBConnRef->selectField(string, string, array, string)
#8 /home/otelriuj/domainname.org/w/includes/cache/localisation/LocalisationCache.php(449): LCStoreDB->get(string, string)
#9 /home/otelriuj/domainname.org/w/includes/cache/localisation/LocalisationCache.php(495): LocalisationCache->isExpired(string)
#10 /home/otelriuj/domainname.org/w/includes/cache/localisation/LocalisationCache.php(371): LocalisationCache->initLanguage(string)
#11 /home/otelriuj/domainname.org/w/includes/cache/localisation/LocalisationCache.php(312): LocalisationCache->loadItem(string, string)
#12 /home/otelriuj/domainname.org/w/includes/language/LanguageFallback.php(106): LocalisationCache->getItem(string, string)
#13 /home/otelriuj/domainname.org/w/includes/language/LanguageFactory.php(175): MediaWiki\Languages\LanguageFallback->getAll(string)
#14 /home/otelriuj/domainname.org/w/includes/language/LanguageFactory.php(121): MediaWiki\Languages\LanguageFactory->newFromCode(string)
#15 /home/otelriuj/domainname.org/w/includes/ServiceWiring.php(240): MediaWiki\Languages\LanguageFactory->getLanguage(string)
#16 /home/otelriuj/domainname.org/w/vendor/wikimedia/services/src/ServiceContainer.php(447): Wikimedia\Services\ServiceContainer->{closure}(MediaWiki\MediaWikiServices)
#17 /home/otelriuj/domainname.org/w/vendor/wikimedia/services/src/ServiceContainer.php(416): Wikimedia\Services\ServiceContainer->createService(string)
#18 /home/otelriuj/domainname.org/w/includes/MediaWikiServices.php(623): Wikimedia\Services\ServiceContainer->getService(string)
#19 /home/otelriuj/domainname.org/w/includes/ServiceWiring.php(693): MediaWiki\MediaWikiServices->getContentLanguage()
#20 /home/otelriuj/domainname.org/w/vendor/wikimedia/services/src/ServiceContainer.php(447): Wikimedia\Services\ServiceContainer->{closure}(MediaWiki\MediaWikiServices)
#21 /home/otelriuj/domainname.org/w/vendor/wikimedia/services/src/ServiceContainer.php(416): Wikimedia\Services\ServiceContainer->createService(string)
#22 /home/otelriuj/domainname.org/w/includes/MediaWikiServices.php(925): Wikimedia\Services\ServiceContainer->getService(string)
#23 /home/otelriuj/domainname.org/w/includes/language/Message.php(1301): MediaWiki\MediaWikiServices->getMessageCache()
#24 /home/otelriuj/domainname.org/w/includes/language/Message.php(862): Message->fetchMessage()
#25 /home/otelriuj/domainname.org/w/includes/language/Message.php(991): Message->toString(string)
#26 /home/otelriuj/domainname.org/w/includes/installer/WebInstallerInstall.php(85): Message->escaped()
#27 /home/otelriuj/domainname.org/w/includes/installer/Installer.php(1619): WebInstallerInstall->endStage(string, Status)
#28 /home/otelriuj/domainname.org/w/includes/installer/WebInstallerInstall.php(44): Installer->performInstallation(array, array)
#29 /home/otelriuj/domainname.org/w/includes/installer/WebInstaller.php(269): WebInstallerInstall->execute()
#30 /home/otelriuj/domainname.org/w/mw-config/index.php(82): WebInstaller->execute(array)
#31 /home/otelriuj/domainname.org/w/mw-config/index.php(40): wfInstallerMain()
#32 {main}

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptAug 23 2020, 7:31 PM
FlaxorDeLux renamed this task from Install from scratch stops with error 1146 "Table 'l10n_cache' does not exist to Install from scratch stops with error 1146 "Table 'l10n_cache' does not exist".Aug 23 2020, 7:31 PM
Majavah added a subscriber: Majavah.
FlaxorDeLux updated the task description. (Show Details)Aug 23 2020, 7:34 PM
FlaxorDeLux updated the task description. (Show Details)Aug 23 2020, 7:51 PM
Seb35 added a subscriber: Seb35.Aug 31 2020, 11:16 AM

I can confirm this issue with MediaWiki 1.35rc2 with PHP 7.3.19 and MySQL 5.8.

After multiple tests, it is only in the case mentionned in the task: Install language = 'en' and Wiki language != 'en'.

It works fine when Install language != 'en', whatever is the Wiki language ('sv', 'en', etc). It tried with object caching as Memcached or APCu, it seems it don’t have an influence.

Always with a fresh install, the bug exists in 1.35.0-rc.0 but does not exist with 1.34.2. It seems it is not linked to availability to write in the subdirectory 'cache'.

Seb35 added a comment.EditedAug 31 2020, 2:19 PM

I bisected the issue and it originates in 11f241589bc: it did not exist before and occurs always after. (I have not analysed it further for now.)

ping @Ladsgroup as author of the commit, possibly you can see quickly how to solve this.

Seb35 added a comment.Aug 31 2020, 3:50 PM

Even if I do not fully understand, here are some pieces: during database install, after the step "createTables", the message subsystem tries to load something from the database table "l10n_cache" but this one is not initialised at this step, it will be after the next step "createManualTables".

When I remove the calls to wfMessage in WebInstallerInstall::startStage and WebInstallerInstall::endStage during the steps "tables", "user", "tables-manual", it works.

A work hypothesis is that the message subsystem (Message, etc) is reinitialised at some point and/or mixed with the wiki language (after the step 'tables'), and the half-initialisation of the database now splitted between "createTables" and "createManualTables" uncovered the issue.


I find this issue is not a blocker for MediaWiki 1.35.0 given users will often install the wiki with the same language as the wiki itself, and there is no issue in this case.

I have looked at this and I think this is not caused by the abstraction work I've been doing. It's very very likely caused by the decoupling work. There's no guarantee that these tables would exist during install meaning and that's why Installer.php disables LC cache backend in the __construct:

$mwServices->getLocalisationCache()->disableBackend();

but this disabling somehow doesn't get enforced if the language is not English? @daniel probably knows better.

daniel triaged this task as High priority.Sep 8 2020, 5:11 PM
daniel claimed this task.Sep 8 2020, 5:55 PM
daniel moved this task from Inbox to Ready on the Platform Team Workboards (Clinic Duty Team) board.

Change 627276 had a related patch set uploaded (by Daniel Kinzler; owner: Daniel Kinzler):
[mediawiki/core@master] DNM: investigating stale Language objects access in installer.

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

I have spent two days poking around the installer, and I have only gotten more confused. Basically, the global RequestContext ends up with a stale Language object. But forcing a fresh Language object after resetting the service container didn't fix it for me. I must be missing something...

Change 628180 had a related patch set uploaded (by Daniel Kinzler; owner: Daniel Kinzler):
[mediawiki/core@master] Installer: consistently reset Language objects

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

Change 627276 abandoned by Daniel Kinzler:
[mediawiki/core@master] DNM: investigating stale Language objects access in installer.

Reason:
I0ccab2b7fcac6942016430b1df5a1dbeb192f2f6

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

Analysis:

Language objects contain references to service objects, so they need to be be discarded when the global service container is reset by calling MediaWikiServices::resetGlobalInstace(). The Installer class was doing this correctly in the constructor, however, there where other calls to resetGlobalInstace() during the installation process that did not properly reset all language objects, which resulted in incorrect instances of LocalisationCache being accessed.

Change 628180 merged by jenkins-bot:
[mediawiki/core@master] Installer: consistently reset Language objects

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

Change 628556 had a related patch set uploaded (by Jforrester; owner: Daniel Kinzler):
[mediawiki/core@REL1_35] Installer: consistently reset Language objects

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

I've merged and made a back-port with a manual fiddle to make it land (reverting removal of wgMemc). Review and final check appreciated.

Change 628556 merged by jenkins-bot:
[mediawiki/core@REL1_35] Installer: consistently reset Language objects

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

Reedy moved this task from Blocker to Done on the MW-1.35-release board.Sep 23 2020, 11:14 PM

@daniel: Hi, all related patches in Gerrit have been merged or abandoned. Is there more to do in this task, or should this be resolved? Asking as you are set as task assignee. Thanks in advance!