Page MenuHomePhabricator

PHP Deprecated: Deprecated cross-wiki access to MediaWiki\Revision\RevisionRecord. Expected: the local wiki, Actual: 'guwwiki'. Pass expected $wikiId. [Called from MediaWiki\Revision\RevisionRecord::getPageId]
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error
  • mwversion: 1.39.0-wmf.3
  • reqId: f746a9876b81bf0df408476d
normalized_message
[{reqId}] {exception_url}   PHP Deprecated: Deprecated cross-wiki access to MediaWiki\Revision\RevisionRecord. Expected: the local wiki, Actual: 'guwwiki'. Pass expected $wikiId. [Called from MediaWiki\Revision\RevisionRecord::getPageId]
exception.trace
from /srv/mediawiki/php-1.39.0-wmf.3/includes/Revision/RevisionRecord.php(336)
#0 [internal function]: MWExceptionHandler::handleError(integer, string, string, string, array)
#1 /srv/mediawiki/php-1.39.0-wmf.3/includes/debug/MWDebug.php(377): trigger_error(string, integer)
#2 /srv/mediawiki/php-1.39.0-wmf.3/includes/debug/MWDebug.php(353): MWDebug::sendRawDeprecated(string, boolean, string)
#3 /srv/mediawiki/php-1.39.0-wmf.3/includes/GlobalFunctions.php(1038): MWDebug::deprecatedMsg(string, string, string, integer)
#4 /srv/mediawiki/php-1.39.0-wmf.3/includes/dao/WikiAwareEntityTrait.php(79): wfDeprecatedMsg(string, string)
#5 /srv/mediawiki/php-1.39.0-wmf.3/includes/Revision/RevisionRecord.php(336): MediaWiki\Revision\RevisionRecord->deprecateInvalidCrossWiki(boolean, string)
#6 /srv/mediawiki/php-1.39.0-wmf.3/extensions/EventBus/includes/EventFactory.php(180): MediaWiki\Revision\RevisionRecord->getPageId()
#7 /srv/mediawiki/php-1.39.0-wmf.3/extensions/EventBus/includes/EventFactory.php(741): MediaWiki\Extension\EventBus\EventFactory->createRevisionRecordAttrs(MediaWiki\Revision\RevisionStoreRecord)
#8 /srv/mediawiki/php-1.39.0-wmf.3/extensions/EventBus/includes/EventBusHooks.php(337): MediaWiki\Extension\EventBus\EventFactory->createRevisionCreateEvent(string, MediaWiki\Revision\RevisionStoreRecord)
#9 /srv/mediawiki/php-1.39.0-wmf.3/extensions/EventBus/includes/EventBusHooks.php(322): MediaWiki\Extension\EventBus\EventBusHooks::sendRevisionCreateEvent(string, MediaWiki\Revision\RevisionStoreRecord)
#10 /srv/mediawiki/php-1.39.0-wmf.3/includes/HookContainer/HookContainer.php(338): MediaWiki\Extension\EventBus\EventBusHooks::onRevisionRecordInserted(MediaWiki\Revision\RevisionStoreRecord)
#11 /srv/mediawiki/php-1.39.0-wmf.3/includes/HookContainer/HookContainer.php(137): MediaWiki\HookContainer\HookContainer->callLegacyHook(string, array, array, array)
#12 /srv/mediawiki/php-1.39.0-wmf.3/includes/HookContainer/HookRunner.php(3191): MediaWiki\HookContainer\HookContainer->run(string, array)
#13 /srv/mediawiki/php-1.39.0-wmf.3/includes/Revision/RevisionStore.php(533): MediaWiki\HookContainer\HookRunner->onRevisionRecordInserted(MediaWiki\Revision\RevisionStoreRecord)
#14 /srv/mediawiki/php-1.39.0-wmf.3/includes/Storage/PageUpdater.php(1463): MediaWiki\Revision\RevisionStore->insertRevisionOn(MediaWiki\Revision\RevisionStoreRecord, Wikimedia\Rdbms\DBConnRef)
#15 /srv/mediawiki/php-1.39.0-wmf.3/includes/Storage/PageUpdater.php(911): MediaWiki\Storage\PageUpdater->doCreate(CommentStoreComment)
#16 /srv/mediawiki/php-1.39.0-wmf.3/includes/page/WikiPage.php(1995): MediaWiki\Storage\PageUpdater->saveRevision(CommentStoreComment, integer)
#17 /srv/mediawiki/php-1.39.0-wmf.3/extensions/WikimediaMaintenance/addWiki.php(200): WikiPage->doUserEditContent(WikitextContent, User, CommentStoreComment, integer)
#18 /srv/mediawiki/php-1.39.0-wmf.3/maintenance/doMaintenance.php(114): AddWiki->execute()
#19 /srv/mediawiki/php-1.39.0-wmf.3/extensions/WikimediaMaintenance/addWiki.php(492): require_once(string)
#20 /srv/mediawiki/multiversion/MWScript.php(116): require_once(string)
#21 {main}
Impact

None, deprecation warnings only.

Notes

This shows up when running addWiki.php.

Details

MediaWiki Version
1.39.0-wmf.3

Event Timeline

addWiki.php is documented to get run on another wiki, while creating a new wiki and this is the addition of the main page to the new wiki (https://guw.wikipedia.org/w/index.php?oldid=1&uselang=en matched also this bug creation timestamp)

The EventFactory is given a dbdomain, but that is set by wgDBname and looks not the correct value. Only the RevisionStore is redefined (T200471) to point to the new domain. Other database access seems to point to the new wiki correctly, the page-creation log is visible onwiki (https://guw.wikipedia.org/wiki/Special:Log?type=create&user=Maintenance+script&uselang=en)

Maybe the EventFactory is using the wrong/stale RevisionStore, because it was already init before addWiki.php redefines the service. But why the rest points to the correct db.
Just using the db domain and give it to the RevisionStore seems not the right way. I am not sure if that would work. Other services all working with the local db (what ever that is on wiki creation)

Still happens. Updated stacktrace:

Error
normalized_message
[{reqId}] {exception_url}   PHP Deprecated: Deprecated cross-wiki access to MediaWiki\Revision\RevisionRecord. Expected: the local wiki, Actual: 'bdrwiki'. Pass expected $wikiId. [Called from MediaWiki\Revision\RevisionRecord::getPageId]
exception.trace
from /srv/mediawiki/php-1.43.0-wmf.17/includes/Revision/RevisionRecord.php(355)
#0 [internal function]: MWExceptionHandler::handleError(int, string, string, string, array)
#1 /srv/mediawiki/php-1.43.0-wmf.17/includes/debug/MWDebug.php(385): trigger_error(string, int)
#2 /srv/mediawiki/php-1.43.0-wmf.17/includes/debug/MWDebug.php(356): MediaWiki\Debug\MWDebug::sendRawDeprecated(string, bool, string)
#3 /srv/mediawiki/php-1.43.0-wmf.17/includes/GlobalFunctions.php(804): MediaWiki\Debug\MWDebug::deprecatedMsg(string, string, string, int)
#4 /srv/mediawiki/php-1.43.0-wmf.17/includes/dao/WikiAwareEntityTrait.php(76): wfDeprecatedMsg(string, string)
#5 /srv/mediawiki/php-1.43.0-wmf.17/includes/Revision/RevisionRecord.php(355): MediaWiki\Revision\RevisionRecord->deprecateInvalidCrossWiki(bool, string)
#6 /srv/mediawiki/php-1.43.0-wmf.17/extensions/EventBus/includes/EventFactory.php(210): MediaWiki\Revision\RevisionRecord->getPageId()
#7 /srv/mediawiki/php-1.43.0-wmf.17/extensions/EventBus/includes/EventFactory.php(788): MediaWiki\Extension\EventBus\EventFactory->createRevisionRecordAttrs(MediaWiki\Revision\RevisionStoreRecord, MediaWiki\User\User)
#8 /srv/mediawiki/php-1.43.0-wmf.17/extensions/EventBus/includes/EventBusHooks.php(417): MediaWiki\Extension\EventBus\EventFactory->createRevisionCreateEvent(string, MediaWiki\Revision\RevisionStoreRecord)
#9 /srv/mediawiki/php-1.43.0-wmf.17/extensions/EventBus/includes/EventBusHooks.php(398): MediaWiki\Extension\EventBus\EventBusHooks::sendRevisionCreateEvent(string, MediaWiki\Revision\RevisionStoreRecord)
#10 /srv/mediawiki/php-1.43.0-wmf.17/includes/HookContainer/HookContainer.php(159): MediaWiki\Extension\EventBus\EventBusHooks->onRevisionRecordInserted(MediaWiki\Revision\RevisionStoreRecord)
#11 /srv/mediawiki/php-1.43.0-wmf.17/includes/HookContainer/HookRunner.php(3297): MediaWiki\HookContainer\HookContainer->run(string, array)
#12 /srv/mediawiki/php-1.43.0-wmf.17/includes/Revision/RevisionStore.php(525): MediaWiki\HookContainer\HookRunner->onRevisionRecordInserted(MediaWiki\Revision\RevisionStoreRecord)
#13 /srv/mediawiki/php-1.43.0-wmf.17/includes/Storage/PageUpdater.php(1515): MediaWiki\Revision\RevisionStore->insertRevisionOn(MediaWiki\Revision\RevisionStoreRecord, Wikimedia\Rdbms\DBConnRef)
#14 /srv/mediawiki/php-1.43.0-wmf.17/includes/Storage/PageUpdater.php(935): MediaWiki\Storage\PageUpdater->doCreate(MediaWiki\CommentStore\CommentStoreComment)
#15 /srv/mediawiki/php-1.43.0-wmf.17/includes/page/WikiPage.php(1692): MediaWiki\Storage\PageUpdater->saveRevision(MediaWiki\CommentStore\CommentStoreComment, int)
#16 /srv/mediawiki/php-1.43.0-wmf.17/extensions/WikimediaMaintenance/addWiki.php(218): WikiPage->doUserEditContent(WikitextContent, MediaWiki\User\User, MediaWiki\CommentStore\CommentStoreComment, int)
#17 /srv/mediawiki/php-1.43.0-wmf.17/maintenance/includes/MaintenanceRunner.php(696): AddWiki->execute()
#18 /srv/mediawiki/php-1.43.0-wmf.17/maintenance/run.php(51): MediaWiki\Maintenance\MaintenanceRunner->run()
#19 /srv/mediawiki/multiversion/MWScript.php(158): require_once(string)
#20 {main}

I'm going to unassign myself.

This looks to be something deep in MW core, where the onRevisionRecordInserted hook is being called with a RevisionRecord using the wrong database? RevisionRecord->getPageId() is throwing the exception.

On reading the code, I thought maybe this sequence of calls could be a problem too:

// $this->titleFormatter is injected from MediaWikiServices $services->getTitleFormatter().

$linkTarget = $revision->getPageAsLinkTarget();
// [...]
'page_title'         => $this->titleFormatter->getPrefixedDBkey( $linkTarget ),

Will $this->titleFormatter work with the $linkTarget retrieved from this RevisionRecord?

But, that is not the code throwing the exception, so ¯\_(ツ)_/¯

Pppery subscribed.

This is probably obsolete following T352113

(re-adding Event-Platform since it seems to have only been removed to suppress a herald rule)

Ottomata claimed this task.

Oh ho! well then I will be bold and resolve this. If it happens again feel free to reopen.