Page MenuHomePhabricator

"Error connecting to [Null] as user [Null]" (from DBFileJournal via DBFileJournalIntegrationTest)
Closed, ResolvedPublic

Description

This is blocking the re-enablement of the "assert no runtime errors" step in CI, which checks that mw-error.log remains empty. This was accidentally removed a few months ago (T246358).

This error ocurrs once on every build.

mw-deberror.log
Fri Mar 20 18:10:36 UTC 2020	32a44f17c9c0	wikidb-unittest_	Error connecting to [Null] as user [Null]: Got schema 'such'; not supported.
#0 /workspace/src/includes/libs/rdbms/database/DatabaseMysqlBase.php(126): Wikimedia\Rdbms\Database->newExceptionAfterConnectError(string)
#1 /workspace/src/includes/libs/rdbms/database/Database.php(322): Wikimedia\Rdbms\DatabaseMysqlBase->open(string, string, string, string, string, string)
#2 /workspace/src/includes/libs/rdbms/database/Database.php(306): Wikimedia\Rdbms\Database->doInitConnection()
#3 /workspace/src/includes/libs/rdbms/loadbalancer/LoadBalancer.php(1329): Wikimedia\Rdbms\Database->initConnection()
#4 /workspace/src/includes/libs/rdbms/loadbalancer/LoadBalancer.php(1209): Wikimedia\Rdbms\LoadBalancer->reallyOpenConnection(integer, Wikimedia\Rdbms\DatabaseDomain, array)
#5 /workspace/src/includes/libs/rdbms/loadbalancer/LoadBalancer.php(930): Wikimedia\Rdbms\LoadBalancer->getForeignConnection(integer, string, integer)
#6 /workspace/src/includes/libs/rdbms/loadbalancer/LoadBalancer.php(901): Wikimedia\Rdbms\LoadBalancer->getServerConnection(integer, string, integer)
#7 /workspace/src/includes/filebackend/filejournal/DBFileJournal.php(191): Wikimedia\Rdbms\LoadBalancer->getConnection(integer, array, string)
#8 /workspace/src/includes/filebackend/filejournal/DBFileJournal.php(61): DBFileJournal->getMasterDB()
#9 /workspace/src/includes/libs/filebackend/filejournal/FileJournal.php(111): DBFileJournal->doLogChangeBatch(array, string)
#10 /workspace/src/tests/phpunit/includes/filebackend/filejournal/DBFileJournalIntegrationTest.php(48): FileJournal->logChangeBatch(array, string)
#11 /workspace/src/vendor/phpunit/phpunit/src/Framework/TestCase.php(1408): DBFileJournalIntegrationTest->testDoLogChangeBatch_exceptionDbConnect()
#12 /workspace/src/vendor/phpunit/phpunit/src/Framework/TestCase.php(1028): PHPUnit\Framework\TestCase->runTest()
#13 /workspace/src/vendor/phpunit/phpunit/src/Framework/TestResult.php(691): PHPUnit\Framework\TestCase->runBare()
#14 /workspace/src/vendor/phpunit/phpunit/src/Framework/TestCase.php(756): PHPUnit\Framework\TestResult->run(DBFileJournalIntegrationTest)
#15 /workspace/src/tests/phpunit/MediaWikiIntegrationTestCase.php(418): PHPUnit\Framework\TestCase->run(PHPUnit\Framework\TestResult)
#16 /workspace/src/vendor/phpunit/phpunit/src/Framework/TestSuite.php(597): MediaWikiIntegrationTestCase->run(PHPUnit\Framework\TestResult)
#17 /workspace/src/vendor/phpunit/phpunit/src/Framework/TestSuite.php(597): PHPUnit\Framework\TestSuite->run(PHPUnit\Framework\TestResult)
#18 /workspace/src/vendor/phpunit/phpunit/src/Framework/TestSuite.php(597): PHPUnit\Framework\TestSuite->run(PHPUnit\Framework\TestResult)
#19 /workspace/src/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(621): PHPUnit\Framework\TestSuite->run(PHPUnit\Framework\TestResult)
#20 /workspace/src/vendor/phpunit/phpunit/src/TextUI/Command.php(200): PHPUnit\TextUI\TestRunner->doRun(PHPUnit\Framework\TestSuite, array, boolean)
#21 /workspace/src/tests/phpunit/phpunit.php(71): PHPUnit\TextUI\Command->run(array, boolean)
#22 /workspace/src/maintenance/doMaintenance.php(99): PHPUnitMaintClass->execute()
#23 /workspace/src/tests/phpunit/phpunit.php(130): require(string)
#24 {main}

Event Timeline

Krinkle created this task.Mar 20 2020, 6:57 PM
Restricted Application added a project: Commons. · View Herald TranscriptMar 20 2020, 6:57 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Anomie added a subscriber: Anomie.Mar 20 2020, 10:03 PM

Again, this appears to be a log message coming from a test that's specifically testing for proper behavior in a failure case. In this case it appears to be DBFileJournalIntegrationTest::testDoLogChangeBatch_exceptionDbConnect(), added in rMW5bbcaef2317f: FileJournal tests.

The IntegrationTestCase class provides a setLogger method that can be used for this purpose, by stubbing out reports to a log channel, or (if desired) by mocking to an explicit expectation of it being logged. (example in ResourceLoaderTest).

Anomie added a subscriber: nnikkhoui.

@nnikkhoui Since you claimed the other tasks that are like this one, do you want to claim this one too?

@Anomie Yea sounds good!

daniel triaged this task as High priority.Apr 7 2020, 1:02 PM

Change 587598 had a related patch set uploaded (by Nikki Nikkhoui; owner: Nikki Nikkhoui):
[mediawiki/core@master] Set logger to null when connecting to DB in DBFileJournalIntegrationTest.php

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

Change 587598 had a related patch set uploaded (by Nikki Nikkhoui; owner: Nikki Nikkhoui):
[mediawiki/core@master] Set logger to null when connecting to DB in DBFileJournalIntegrationTest.php

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

Change 587598 merged by jenkins-bot:
[mediawiki/core@master] Set logger to null when connecting to DB in DBFileJournalIntegrationTest.php

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

nnikkhoui closed this task as Resolved.Apr 13 2020, 5:37 PM