Page MenuHomePhabricator

Wikimedia\Assert\PreconditionException: Expected MediaWiki\Block\AbstractBlock to belong to the local wiki, but it belongs to 'huwiki'
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error
normalized_message
[{reqId}] {exception_url}   Wikimedia\Assert\PreconditionException: Expected MediaWiki\Block\AbstractBlock to belong to the local wiki, but it belongs to 'huwiki'
exception.trace
from /srv/mediawiki/php-1.42.0-wmf.19/includes/dao/WikiAwareEntityTrait.php(59)
#0 /srv/mediawiki/php-1.42.0-wmf.19/includes/block/DatabaseBlock.php(355): MediaWiki\Block\AbstractBlock->assertWiki(boolean)
#1 /srv/mediawiki/php-1.42.0-wmf.19/includes/block/DatabaseBlockStore.php(546): MediaWiki\Block\DatabaseBlock->getId()
#2 /srv/mediawiki/php-1.42.0-wmf.19/includes/block/DatabaseBlockStore.php(1937): MediaWiki\Block\DatabaseBlockStore->newLoad(string, integer, boolean)
#3 /srv/mediawiki/php-1.42.0-wmf.19/includes/block/DatabaseBlock.php(289): MediaWiki\Block\DatabaseBlockStore->doAutoblock(MediaWiki\Block\DatabaseBlock, string)
#4 /srv/mediawiki/php-1.42.0-wmf.19/extensions/CheckUser/src/Hooks.php(856): MediaWiki\Block\DatabaseBlock->doAutoblock(string)
#5 /srv/mediawiki/php-1.42.0-wmf.19/includes/HookContainer/HookContainer.php(159): MediaWiki\CheckUser\Hooks->onPerformRetroactiveAutoblock(MediaWiki\Block\DatabaseBlock, array)
#6 /srv/mediawiki/php-1.42.0-wmf.19/includes/HookContainer/HookRunner.php(3068): MediaWiki\HookContainer\HookContainer->run(string, array)
#7 /srv/mediawiki/php-1.42.0-wmf.19/includes/block/DatabaseBlockStore.php(1837): MediaWiki\HookContainer\HookRunner->onPerformRetroactiveAutoblock(MediaWiki\Block\DatabaseBlock, array)
#8 /srv/mediawiki/php-1.42.0-wmf.19/includes/block/DatabaseBlockStore.php(1223): MediaWiki\Block\DatabaseBlockStore->doRetroactiveAutoblock(MediaWiki\Block\DatabaseBlock)
#9 /srv/mediawiki/php-1.42.0-wmf.19/extensions/CentralAuth/includes/User/CentralAuthUser.php(2041): MediaWiki\Block\DatabaseBlockStore->insertBlock(MediaWiki\Block\DatabaseBlock)
#10 /srv/mediawiki/php-1.42.0-wmf.19/extensions/CentralAuth/includes/User/CentralAuthUser.php(1960): MediaWiki\Extension\CentralAuth\User\CentralAuthUser->doLocalSuppression(boolean, string, string, string)
#11 /srv/mediawiki/php-1.42.0-wmf.19/extensions/CentralAuth/includes/User/CentralAuthUser.php(1938): MediaWiki\Extension\CentralAuth\User\CentralAuthUser->doCrosswikiSuppression(boolean, string, string)
#12 /srv/mediawiki/php-1.42.0-wmf.19/extensions/CentralAuth/includes/User/CentralAuthUser.php(1900): MediaWiki\Extension\CentralAuth\User\CentralAuthUser->suppress(string, string)
#13 /srv/mediawiki/php-1.42.0-wmf.19/extensions/CentralAuth/includes/Special/SpecialCentralAuth.php(304): MediaWiki\Extension\CentralAuth\User\CentralAuthUser->adminLockHide(boolean, integer, string, MediaWiki\Context\RequestContext)
#14 /srv/mediawiki/php-1.42.0-wmf.19/extensions/CentralAuth/includes/Special/SpecialCentralAuth.php(202): MediaWiki\Extension\CentralAuth\Special\SpecialCentralAuth->doSubmit()
#15 /srv/mediawiki/php-1.42.0-wmf.19/includes/specialpage/SpecialPage.php(720): MediaWiki\Extension\CentralAuth\Special\SpecialCentralAuth->execute(NULL)
#16 /srv/mediawiki/php-1.42.0-wmf.19/includes/specialpage/SpecialPageFactory.php(1653): MediaWiki\SpecialPage\SpecialPage->run(NULL)
#17 /srv/mediawiki/php-1.42.0-wmf.19/includes/actions/ActionEntryPoint.php(504): MediaWiki\SpecialPage\SpecialPageFactory->executePath(string, MediaWiki\Context\RequestContext)
#18 /srv/mediawiki/php-1.42.0-wmf.19/includes/actions/ActionEntryPoint.php(145): MediaWiki\Actions\ActionEntryPoint->performRequest()
#19 /srv/mediawiki/php-1.42.0-wmf.19/includes/MediaWikiEntryPoint.php(199): MediaWiki\Actions\ActionEntryPoint->execute()
#20 /srv/mediawiki/php-1.42.0-wmf.19/index.php(58): MediaWiki\MediaWikiEntryPoint->run()
#21 /srv/mediawiki/w/index.php(3): require(string)
#22 {main}
Impact

This makes it impossible to globally suppress an account from Special:CentralAuth. Such actions are typically time sensitive, meaning the error is likely infrequent, but the error is high-impactful.

Notes

Such an error happened before (T354298, T353620 and possibly others). Please keep in mind CentralAuth and its integration with blocks when refactoring / adding new assertions!

Event Timeline

Urbanecm created this task.

Change 1005833 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/core@master] block: Pass wikiId to DatabaseBlock::getId in DatabaseBlockStore

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

Umherirrender added subscribers: Zabe, Umherirrender.

3a1c95e9 is the trigger for this, but not the cause in code

It seems it was missed from the begin of wiki aware blocks in b6793e47 (code was moved in d06ac1a3)

Change 1005701 had a related patch set uploaded (by Zabe; author: Umherirrender):

[mediawiki/core@wmf/1.42.0-wmf.19] block: Pass wikiId to DatabaseBlock::getId in DatabaseBlockStore

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

Change 1005833 merged by jenkins-bot:

[mediawiki/core@master] block: Pass wikiId to DatabaseBlock::getId in DatabaseBlockStore

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

Change 1005701 merged by jenkins-bot:

[mediawiki/core@wmf/1.42.0-wmf.19] block: Pass wikiId to DatabaseBlock::getId in DatabaseBlockStore

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

Mentioned in SAL (#wikimedia-operations) [2024-02-23T00:03:20Z] <zabe@deploy2002> Started scap: Backport for [[gerrit:1005701|block: Pass wikiId to DatabaseBlock::getId in DatabaseBlockStore (T358208)]]

Mentioned in SAL (#wikimedia-operations) [2024-02-23T00:04:43Z] <zabe@deploy2002> zabe: Backport for [[gerrit:1005701|block: Pass wikiId to DatabaseBlock::getId in DatabaseBlockStore (T358208)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Mentioned in SAL (#wikimedia-operations) [2024-02-23T00:14:22Z] <zabe@deploy2002> Finished scap: Backport for [[gerrit:1005701|block: Pass wikiId to DatabaseBlock::getId in DatabaseBlockStore (T358208)]] (duration: 11m 02s)

I had difficulties reproducing this, but I think this should be fixed.