CI tests throw warning "Cannot find site mywiki in sites table"
Closed, ResolvedPublic

Description

https://integration.wikimedia.org/ci/job/mediawiki-extensions-qunit-jessie/19494/console fails due a Cannot find site mywiki in sites table error which is injected in a javascript file /index.php?title=Special:JavaScriptTest/qunit/export. That causes the web browser to not process the javascript and thus fail the qunit build.

From a previous discussion, it seems the fix would be to properly initializing the site table when installing/updating MediaWiki with Wikibase: T126596

00:02:38 PHP Notice:  Cannot find site mywiki in sites table [Called from Wikibase\Client\WikibaseClient::newSiteGroup in /home/jenkins/workspace/mediawiki-extensions-qunit-jessie/src/extensions/Wikidata/extensions/Wikibase/client/includes/WikibaseClient.php at line 734] in /home/jenkins/workspace/mediawiki-extensions-qunit-jessie/src/includes/debug/MWDebug.php on line 309
00:02:38 PHP Stack trace:
00:02:38 PHP   1. {main}() /home/jenkins/workspace/mediawiki-extensions-qunit-jessie/src/maintenance/update.php:0
00:02:38 PHP   2. require_once() /home/jenkins/workspace/mediawiki-extensions-qunit-jessie/src/maintenance/update.php:217
00:02:38 PHP   3. UpdateMediaWiki->execute() /home/jenkins/workspace/mediawiki-extensions-qunit-jessie/src/maintenance/doMaintenance.php:111
00:02:38 PHP   4. LoggedUpdateMaintenance->execute() /home/jenkins/workspace/mediawiki-extensions-qunit-jessie/src/maintenance/update.php:184
00:02:38 PHP   5. FlowCreateTemplates->doDBUpdates() /home/jenkins/workspace/mediawiki-extensions-qunit-jessie/src/maintenance/Maintenance.php:1576
00:02:38 PHP   6. FlowCreateTemplates->create() /home/jenkins/workspace/mediawiki-extensions-qunit-jessie/src/extensions/Flow/maintenance/FlowCreateTemplates.php:86
00:02:38 PHP   7. WikiPage->doEditContent() /home/jenkins/workspace/mediawiki-extensions-qunit-jessie/src/extensions/Flow/maintenance/FlowCreateTemplates.php:115
00:02:38 PHP   8. WikiPage->prepareContentForEdit() /home/jenkins/workspace/mediawiki-extensions-qunit-jessie/src/includes/page/WikiPage.php:1688
00:02:38 PHP   9. AbstractContent->getParserOutput() /home/jenkins/workspace/mediawiki-extensions-qunit-jessie/src/includes/page/WikiPage.php:2153
00:02:38 PHP  10. Hooks::run() /home/jenkins/workspace/mediawiki-extensions-qunit-jessie/src/includes/content/AbstractContent.php:501
00:02:38 PHP  11. call_user_func_array:{/home/jenkins/workspace/mediawiki-extensions-qunit-jessie/src/includes/Hooks.php:195}() /home/jenkins/workspace/mediawiki-extensions-qunit-jessie/src/includes/Hooks.php:195
00:02:38 PHP  12. Wikibase\Client\Hooks\ParserOutputUpdateHookHandlers::onContentAlterParserOutput() /home/jenkins/workspace/mediawiki-extensions-qunit-jessie/src/includes/Hooks.php:195
00:02:38 PHP  13. Wikibase\Client\Hooks\ParserOutputUpdateHookHandlers::newFromGlobalState() /home/jenkins/workspace/mediawiki-extensions-qunit-jessie/src/extensions/Wikidata/extensions/Wikibase/client/includes/Hooks/ParserOutputUpdateHookHandlers.php:67
00:02:38 PHP  14. Wikibase\Client\WikibaseClient->getLangLinkHandler() /home/jenkins/workspace/mediawiki-extensions-qunit-jessie/src/extensions/Wikidata/extensions/Wikibase/client/includes/Hooks/ParserOutputUpdateHookHandlers.php:48
00:02:38 PHP  15. Wikibase\Client\WikibaseClient->getLangLinkSiteGroup() /home/jenkins/workspace/mediawiki-extensions-qunit-jessie/src/extensions/Wikidata/extensions/Wikibase/client/includes/WikibaseClient.php:847
00:02:38 PHP  16. Wikibase\Client\WikibaseClient->getSiteGroup() /home/jenkins/workspace/mediawiki-extensions-qunit-jessie/src/extensions/Wikidata/extensions/Wikibase/client/includes/WikibaseClient.php:713
00:02:38 PHP  17. Wikibase\Client\WikibaseClient->newSiteGroup() /home/jenkins/workspace/mediawiki-extensions-qunit-jessie/src/extensions/Wikidata/extensions/Wikibase/client/includes/WikibaseClient.php:752
00:02:38 PHP  18. wfWarn() /home/jenkins/workspace/mediawiki-extensions-qunit-jessie/src/extensions/Wikidata/extensions/Wikibase/client/includes/WikibaseClient.php:734
00:02:38 PHP  19. MWDebug::warning() /home/jenkins/workspace/mediawiki-extensions-qunit-jessie/src/includes/GlobalFunctions.php:1142
00:02:38 PHP  20. MWDebug::sendMessage() /home/jenkins/workspace/mediawiki-extensions-qunit-jessie/src/includes/debug/MWDebug.php:164
00:02:38 PHP  21. trigger_error() /home/jenkins/workspace/mediawiki-extensions-qunit-jessie/src/includes/debug/MWDebug.php:309
Tgr created this task.Dec 20 2016, 1:01 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptDec 20 2016, 1:01 AM

That has been going on line that for a year I think or even longer then a year.

Change 328326 had a related patch set uploaded (by Gergő Tisza):
[TEST] remove dbname warning

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

Restricted Application added subscribers: Jay8g, TerraCodes. · View Herald TranscriptDec 20 2016, 3:52 AM
hashar reopened this task as Open.
hashar added a subscriber: hashar.

Sorry I messed up in Phabricator :(

hashar updated the task description. (Show Details)Dec 20 2016, 11:04 PM

Change 328445 had a related patch set (by Paladox) published:
Remove warning about missing site ID

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

Change 328326 merged by jenkins-bot:
Remove warning about missing site ID

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

Change 328445 merged by jenkins-bot:
Remove warning about missing site ID

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

Tgr closed this task as Resolved.Dec 21 2016, 1:06 AM

https://gerrit.wikimedia.org/r/#/c/328327 is not public or viewable, btw.

Huh, didn't know gerrit can do that (I was using the "create new change" button). Fixed now (but it was just a test anyway).

Change 328496 had a related patch set uploaded (by Daniel Kinzler):
Use default wiki id in example settings.

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

daniel reopened this task as Open.EditedDec 21 2016, 12:12 PM

Reopening. Removing the warning may fix the symptom, but you are just shooting the messenger.

The warning is there for a reason, and needs to be put back. It should probably even be a production warning and use wfLogWarning(), since it is triggered by incomplete configuration. Wikibase will not function correctly if the localSiteID setting is incorrect, so the warning is needed. We can't just igore that situation, so the problem needs to be solved in a different way.

I see two things that need fixing:

  1. wfWarn should fail phpunit tests, but it perhaps should not fail qunit tests. How is that failure triggered? It seems like logging and error reporting on the CI system should be configured in a way that allows qunit tests to pass in the presence of warnings. This raises the question - why did this start to happen now? The warning has been there for years.
  2. The configuration on the CI system should not be incomplete in the first place. When using the example settings that define the local wiki ID to be "mywiki", "mywiki" must actually be a valid wiki ID (according to the sites table). So, either make sure "mywiki" is in the sites table of the CI system (see also I150011d6d2f to make that easier), or change the setting to something that is in the sites table. See Ia0d578a82152 for a patch that would remove the "mywiki" example, and fall back to using the database name as the site ID instead. Not sure that will Just Work on the CI system, though.

Change 328504 had a related patch set uploaded (by Thiemo Mättig (WMDE)):
[WIP] Revert "Remove warning about missing site ID"

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

Achtually, client/config/WikibaseClient.jenkins.php defines $wgWBClientSettings['siteGroup'] = "mywikigroup"; to circumvent this problem (the localWikiId setting is primarily used to detect the wiki's own group). WikibaseClient.jenkins.php is used if Wikibase.php detects that it is being run from jenkins (yea, nasty hack). Perhaps it's that detection that broke? For CI, LocalSettings shoudl set $wgWikimediaJenkinsCI to true before loading Wikibase. That triggers the use of WikibaseClient.jenkins.php.

Change 328496 merged by jenkins-bot:
Use default wiki id in example settings.

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

The sequence of CI for the mediawiki-extensions-qunit-jessie job (and for all others afaik):

  • clone all repos
  • run install.php
  • append to LocalSettings.php snippets from integration/jenkins.git mediawiki/conf.d which among others:
    • sets $wgWikimediaJenkinsCI = true;)
    • add logic to load all cloned extensions
  • run update.php

Looks like we had $wgWBClientSettings['siteGlobalID'] = "mywiki"; and it nows default to $wgDBname (change).

So I guess Daniel change fix up for real now.

Pending is restoring the wfWarn() call: https://gerrit.wikimedia.org/r/328504

Tgr added a comment.Dec 21 2016, 8:24 PM

wfWarn should fail phpunit tests, but it perhaps should not fail qunit tests. How is that failure triggered?

XDebug warnings show up (since last weekend or so) in pages which should contain javascript (Special:JavaScriptTest/qunit/export specifically).

daniel added a comment.EditedDec 22 2016, 9:53 AM

XDebug warnings show up (since last weekend or so) in pages which should contain javascript (Special:JavaScriptTest/qunit/export specifically).

So maybe it's just that the xdebug config (or error_reporting) changed, causing the warning to be shown in the output, instead of a log file?

But honestly - this warning probably should make tests fail. The extension is not configured correctly. It's not hard to configure it correctly. All you need it $wgWBClientSettings['siteGroup'] = "mywikigroup";

Change 329765 had a related patch set uploaded (by Paladox):
Use default wiki id in example settings.

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

Change 329771 had a related patch set uploaded (by Paladox):
Use default wiki id in example settings.

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

Happends on branches REL1_28 and REL1_27 too.

Per @daniel @hashar: $wgWikimediaJenkinsCI = true should cause $wgWBClientSettings['siteGroup'] = "mywikigroup" to be set, if Wikibase is included via the main extension entry point. If siteGroup is set, WikibaseClient::newSiteGroup() should not hit the code path that can trigger the warning. Perhaps try setting $wgWBClientSettings['siteGroup'] directly.

Change 329774 had a related patch set uploaded (by Paladox):
Remove warning about missing site ID

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

Change 329775 had a related patch set uploaded (by Paladox):
Remove warning about missing site ID

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

hashar lowered the priority of this task from Unbreak Now! to High.Jan 4 2017, 3:51 PM

Has been set to Unbreak Now because qunit was falling ( T153597 ). That is no more an issue right now though.

Change 331533 had a related patch set uploaded (by Reedy):
Remove warning about missing site ID

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

Change 331533 merged by jenkins-bot:
Remove warning about missing site ID

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

Change 331542 had a related patch set uploaded (by Reedy):
Remove warning about missing site ID

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

Change 331542 merged by jenkins-bot:
Remove warning about missing site ID

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

Change 331548 had a related patch set uploaded (by Reedy):
Remove warning about missing site ID

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

Change 331548 merged by jenkins-bot:
Remove warning about missing site ID

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

Change 331571 had a related patch set uploaded (by Reedy):
Remove warning about missing site ID

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

Change 329774 merged by jenkins-bot:
Remove warning about missing site ID

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

Change 331571 merged by jenkins-bot:
Remove warning about missing site ID

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

Change 329765 merged by jenkins-bot:
Use default wiki id in example settings.

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

Change 329770 merged by jenkins-bot:
Use default wiki id in example settings.

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

Krinkle removed a subscriber: Krinkle.Feb 25 2017, 4:39 AM

Change 329771 merged by Umherirrender:
[mediawiki/extensions/Wikidata] Use default wiki id in example settings.

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

Change 346916 had a related patch set uploaded (by Paladox; owner: Daniel Kinzler):
[mediawiki/extensions/Wikibase@REL1_27] Use default wiki id in example settings.

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

Change 346916 abandoned by Krinkle:
Use default wiki id in example settings.

Reason:
Closing in favour of I1a52ce07943f20c - which is how it was fixed in master as well.

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

Change 329775 merged by Hashar:
[mediawiki/extensions/Wikidata@REL1_27] Remove warning about missing site ID

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

Krinkle closed this task as Resolved.Jul 13 2017, 5:05 AM

Change 328504 abandoned by Addshore:
[WIP] Revert "Remove warning about missing site ID"

Reason:
Build is dead

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