Page MenuHomePhabricator

addWiki.php warns Deprecated: Premature access to HookContainer, ObjectFactory and ServiceContainer
Closed, ResolvedPublic

Description

See stacktrace:

1[urbanecm@mwmaint1002 ~]$ mwscript extensions/WikimediaMaintenance/addWiki.php --wiki=muswiki alt wikipedia altwiki alt.wikipedia.org
2Deprecated: Premature access to service container [Called from Maintenance::finalSetup in /srv/mediawiki/php-1.36.0-wmf.31/maintenance/includes/Maintenance.php at line 1216] in /srv/mediawiki/php-1.36.0-wmf.31/includes/debug/MWDebug.php on line 376
3Deprecated: Premature access to service 'HookContainer' [Called from MediaWiki\MediaWikiServices::getInstance in /srv/mediawiki/php-1.36.0-wmf.31/includes/MediaWikiServices.php at line 248] in /srv/mediawiki/php-1.36.0-wmf.31/includes/debug/MWDebug.php on line 376
4Deprecated: Premature access to service 'ObjectFactory' [Called from Wikimedia\Services\ServiceContainer::{closure} in /srv/mediawiki/php-1.36.0-wmf.31/includes/ServiceWiring.php at line 516] in /srv/mediawiki/php-1.36.0-wmf.31/includes/debug/MWDebug.php on line 376
5Creating database altwiki for alt.wikipedia (алтай тил)
6Initialising tables
7Initialising external storage cluster26...
8Initialising external storage cluster27...
9Writing main page to Тӧс_бӱк
10Wikimedia\Assert\PreconditionException from line 58 of /srv/mediawiki/php-1.36.0-wmf.31/includes/dao/WikiAwareEntityTrait.php: Expected User to belong to 'altwiki', but it belongs to the local wiki
11#0 /srv/mediawiki/php-1.36.0-wmf.31/includes/user/User.php(2089): User->assertWiki('altwiki')
12#1 /srv/mediawiki/php-1.36.0-wmf.31/includes/Revision/RevisionStore.php(618): User->getUserId('altwiki')
13#2 /srv/mediawiki/php-1.36.0-wmf.31/includes/Revision/RevisionStore.php(552): MediaWiki\Revision\RevisionStore->insertIpChangesRow(Object(Wikimedia\Rdbms\DatabaseMysqli), Object(User), Object(MediaWiki\Revision\MutableRevisionRecord), 1)
14#3 /srv/mediawiki/php-1.36.0-wmf.31/includes/Revision/RevisionStore.php(451): MediaWiki\Revision\RevisionStore->insertRevisionInternal(Object(MediaWiki\Revision\MutableRevisionRecord), Object(Wikimedia\Rdbms\DatabaseMysqli), Object(User), Object(CommentStoreComment), Object(Title), 1, 0) #4 /srv/mediawiki/php-1.36.0-wmf.31/includes/libs/rdbms/database/Database.php(4500): MediaWiki\Revision\RevisionStore->MediaWiki\Revision\{closure}(Object(Wikimedia\Rdbms\DatabaseMysqli), 'MediaWiki\\Revis...') #5 /srv/mediawiki/php-1.36.0-wmf.31/includes/libs/rdbms/database/DBConnRef.php(68): Wikimedia\Rdbms\Database->doAtomicSection('MediaWiki\\Revis...', Object(Closure)) #6 /srv/mediawiki/php-1.36.0-wmf.31/includes/libs/rdbms/database/DBConnRef.php(641): Wikimedia\Rdbms\DBConnRef->__call('doAtomicSection', Array) #7 /srv/mediawiki/php-1.36.0-wmf.31/includes/Revision/RevisionStore.php(453): Wikimedia\Rdbms\DBConnRef->doAtomicSection('MediaWiki\\Revis...', Object(Closure)) #8 /srv/mediawiki/php-1.36.0-wmf.31/includes/Storage/PageUpdater.php(1236): MediaWiki\Revision\RevisionStore->insertRevisionOn(Object(MediaWiki\Revision\MutableRevisionRecord), Object(Wikimedia\Rdbms\DBConnRef))#9 /srv/mediawiki/php-1.36.0-wmf.31/includes/Storage/PageUpdater.php(803): MediaWiki\Storage\PageUpdater->doCreate(Object(CommentStoreComment), Object(User), 65)
15#10 /srv/mediawiki/php-1.36.0-wmf.31/includes/page/WikiPage.php(2076): MediaWiki\Storage\PageUpdater->saveRevision(Object(CommentStoreComment), 65) #11 /srv/mediawiki/php-1.36.0-wmf.31/includes/page/WikiPage.php(1928): WikiPage->doUserEditContent(Object(WikitextContent), Object(User), Object(CommentStoreComment), 65, false, Array, 0) #12 /srv/mediawiki/php-1.36.0-wmf.31/extensions/WikimediaMaintenance/addWiki.php(165): WikiPage->doEditContent(Object(WikitextContent), '', 65) #13 /srv/mediawiki/php-1.36.0-wmf.31/maintenance/doMaintenance.php(106): AddWiki->execute() #14 /srv/mediawiki/php-1.36.0-wmf.31/extensions/WikimediaMaintenance/addWiki.php(450): require_once('/srv/mediawiki/...') #15 /srv/mediawiki/multiversion/MWScript.php(101): require_once('/srv/mediawiki/...') #16 {main}
16[5838f2e9a8b97a8b137ebb77] [no req] Wikimedia\Rdbms\DBTransactionError: Explicit transaction still active. A caller may have caught an error. Open transactions: MediaWiki\Storage\PageUpdater::doCreate
17Backtrace:
18from /srv/mediawiki/php-1.36.0-wmf.31/includes/libs/rdbms/database/Database.php(1523)
19#0 /srv/mediawiki/php-1.36.0-wmf.31/includes/libs/rdbms/loadbalancer/LoadBalancer.php(1728): Wikimedia\Rdbms\Database->assertNoOpenTransactions()
20#1 /srv/mediawiki/php-1.36.0-wmf.31/includes/libs/rdbms/loadbalancer/LoadBalancer.php(2241): Wikimedia\Rdbms\LoadBalancer::Wikimedia\Rdbms\{closure}(Wikimedia\Rdbms\DatabaseMysqli)
21#2 /srv/mediawiki/php-1.36.0-wmf.31/includes/libs/rdbms/loadbalancer/LoadBalancer.php(1747): Wikimedia\Rdbms\LoadBalancer->forEachOpenMasterConnection(Closure)
22#3 /srv/mediawiki/php-1.36.0-wmf.31/includes/libs/rdbms/lbfactory/LBFactory.php(249): Wikimedia\Rdbms\LoadBalancer->approveMasterChanges(array, string, integer)
23#4 /srv/mediawiki/php-1.36.0-wmf.31/includes/libs/rdbms/lbfactory/LBFactoryMulti.php(222): Wikimedia\Rdbms\LBFactory::Wikimedia\Rdbms\{closure}(Wikimedia\Rdbms\LoadBalancer, string, array)
24#5 /srv/mediawiki/php-1.36.0-wmf.31/includes/libs/rdbms/lbfactory/LBFactory.php(251): Wikimedia\Rdbms\LBFactoryMulti->forEachLB(Closure, array)
25#6 /srv/mediawiki/php-1.36.0-wmf.31/includes/libs/rdbms/lbfactory/LBFactory.php(310): Wikimedia\Rdbms\LBFactory->forEachLBCallMethod(string, array)
26#7 /srv/mediawiki/php-1.36.0-wmf.31/maintenance/includes/Maintenance.php(1269): Wikimedia\Rdbms\LBFactory->commitMasterChanges(string)
27#8 /srv/mediawiki/php-1.36.0-wmf.31/maintenance/doMaintenance.php(128): Maintenance->shutdown()
28#9 /srv/mediawiki/php-1.36.0-wmf.31/extensions/WikimediaMaintenance/addWiki.php(450): require_once(string)
29#10 /srv/mediawiki/multiversion/MWScript.php(101): require_once(string)
30#11 {main}
31[urbanecm@mwmaint1002 ~]$

Event Timeline

holger.knust added a subscriber: holger.knust.

It looks like alt wiki was created. Are there any concerns about the state of the wiki?

It looks like alt wiki was created. Are there any concerns about the state of the wiki?

Yes. The wiki is created because we had to run parts of addWiki.php in eval.php otherwise it would have stayed in a really broken state.

holger.knust raised the priority of this task from Medium to High.Feb 23 2021, 2:17 PM

This brings back memories. Think it's long past time we get some tests
added so this script stops getting broken multiple times a year.

I wanted to do it but I gave up on that a while ago. I think it should be extremely modular and instead of running a giant brittle mw script, we should run five or six instead which would make testing most of those scripts possible. There are parts that is not easily testable like elastic search.

The deprecations are probably harmless. I'm going to change the task description.

tstarling renamed this task from addWiki.php throws Deprecated: Premature access to HookContainer, ObjectFactory and ServiceContainer to addWiki.php throws PreconditionException from WikiAwareEntityTrait.Mar 1 2021, 3:17 AM

Oh right, there is a separate task for the exception, which was fixed already.

tstarling renamed this task from addWiki.php throws PreconditionException from WikiAwareEntityTrait to addWiki.php warns Deprecated: Premature access to HookContainer, ObjectFactory and ServiceContainer.Mar 1 2021, 6:07 AM
tstarling lowered the priority of this task from High to Medium.Mar 1 2021, 6:36 AM

I'm lowering the priority since it's hard to imagine some deprecation warnings preventing you from creating wikis. The actual blocker is presumably T275452.

I'm lowering the priority since it's hard to imagine some deprecation warnings preventing you from creating wikis. The actual blocker is presumably T275452.

If it's hard deprecated, it's likely it will be removed "soon", and it may work differently already per stable interface policy. So, still worth fixing I think, althrough the other task is probably higher priority.

Change 702448 had a related patch set uploaded (by Ppchelko; author: Ppchelko):

[mediawiki/core@master] Don't access MWServices prematurely in Maintenence.php

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

Change 702448 merged by jenkins-bot:

[mediawiki/core@master] Don't access MWServices prematurely in Maintenence.php

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

Pchelolo claimed this task.