Page MenuHomePhabricator

[8h] Logspam about an "ignored error" in Wikibase\Repo\Content\DataUpdateAdapter::doUpdate
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error
normalized_message
[{reqId}] {exception_url}   ErrorException: PHP Deprecated: Caller from Wikibase\Repo\Content\DataUpdateAdapter::doUpdate ignored an error originally raised from Wikibase\Lib\Store\Sql\Terms\DatabaseTermStoreWriterBase::acquireAndInsertTerms: [1205] Lock
exception.trace
from /srv/mediawiki/php-1.36.0-wmf.37/includes/debug/MWDebug.php(376)
#0 [internal function]: MWExceptionHandler::handleError(integer, string, string, integer, array)
#1 /srv/mediawiki/php-1.36.0-wmf.37/includes/debug/MWDebug.php(376): trigger_error(string, integer)
#2 /srv/mediawiki/php-1.36.0-wmf.37/includes/db/MWLBFactory.php(349): MWDebug::sendRawDeprecated(string, boolean, string)
#3 [internal function]: MWLBFactory::logDeprecation(string)
#4 /srv/mediawiki/php-1.36.0-wmf.37/includes/libs/rdbms/database/Database.php(1531): call_user_func(array, string)
#5 /srv/mediawiki/php-1.36.0-wmf.37/includes/libs/rdbms/database/Database.php(1237): Wikimedia\Rdbms\Database->assertQueryIsCurrentlyAllowed(string, string)
#6 /srv/mediawiki/php-1.36.0-wmf.37/includes/libs/rdbms/database/Database.php(4666): Wikimedia\Rdbms\Database->query(string, string, integer)
#7 /srv/mediawiki/php-1.36.0-wmf.37/includes/libs/rdbms/database/Database.php(4634): Wikimedia\Rdbms\Database->doCommit(string)
#8 /srv/mediawiki/php-1.36.0-wmf.37/includes/libs/rdbms/loadbalancer/LoadBalancer.php(1812): Wikimedia\Rdbms\Database->commit(string, string)
#9 /srv/mediawiki/php-1.36.0-wmf.37/includes/libs/rdbms/loadbalancer/LoadBalancer.php(2255): Wikimedia\Rdbms\LoadBalancer->Wikimedia\Rdbms\{closure}(Wikimedia\Rdbms\DatabaseMysqli)
#10 /srv/mediawiki/php-1.36.0-wmf.37/includes/libs/rdbms/loadbalancer/LoadBalancer.php(1817): Wikimedia\Rdbms\LoadBalancer->forEachOpenMasterConnection(Closure)
#11 /srv/mediawiki/php-1.36.0-wmf.37/includes/libs/rdbms/lbfactory/LBFactory.php(247): Wikimedia\Rdbms\LoadBalancer->commitMasterChanges(string, integer)
#12 /srv/mediawiki/php-1.36.0-wmf.37/includes/libs/rdbms/lbfactory/LBFactoryMulti.php(236): Wikimedia\Rdbms\LBFactory::Wikimedia\Rdbms\{closure}(Wikimedia\Rdbms\LoadBalancer, string, array)
#13 /srv/mediawiki/php-1.36.0-wmf.37/includes/libs/rdbms/lbfactory/LBFactory.php(249): Wikimedia\Rdbms\LBFactoryMulti->forEachLB(Closure, array)
#14 /srv/mediawiki/php-1.36.0-wmf.37/includes/libs/rdbms/lbfactory/LBFactory.php(312): Wikimedia\Rdbms\LBFactory->forEachLBCallMethod(string, array)
#15 /srv/mediawiki/php-1.36.0-wmf.37/includes/deferred/DeferredUpdates.php(515): Wikimedia\Rdbms\LBFactory->commitMasterChanges(string)
#16 /srv/mediawiki/php-1.36.0-wmf.37/includes/deferred/RefreshSecondaryDataUpdate.php(101): DeferredUpdates::attemptUpdate(Wikibase\Repo\Content\DataUpdateAdapter, Wikimedia\Rdbms\LBFactoryMulti)
#17 /srv/mediawiki/php-1.36.0-wmf.37/includes/deferred/DeferredUpdates.php(513): RefreshSecondaryDataUpdate->doUpdate()
#18 /srv/mediawiki/php-1.36.0-wmf.37/includes/deferred/DeferredUpdates.php(390): DeferredUpdates::attemptUpdate(RefreshSecondaryDataUpdate, Wikimedia\Rdbms\LBFactoryMulti)
#19 /srv/mediawiki/php-1.36.0-wmf.37/includes/deferred/DeferredUpdates.php(221): DeferredUpdates::run(RefreshSecondaryDataUpdate, Wikimedia\Rdbms\LBFactoryMulti, Monolog\Logger, BufferingStatsdDataFactory, string)
#20 /srv/mediawiki/php-1.36.0-wmf.37/includes/deferred/DeferredUpdatesScope.php(264): DeferredUpdates::{closure}(RefreshSecondaryDataUpdate, integer)
#21 /srv/mediawiki/php-1.36.0-wmf.37/includes/deferred/DeferredUpdatesScope.php(196): DeferredUpdatesScope->processStageQueue(integer, integer, Closure)
#22 /srv/mediawiki/php-1.36.0-wmf.37/includes/deferred/DeferredUpdates.php(242): DeferredUpdatesScope->processUpdates(integer, Closure)
#23 /srv/mediawiki/php-1.36.0-wmf.37/includes/MediaWiki.php(1093): DeferredUpdates::doUpdates(string)
#24 /srv/mediawiki/php-1.36.0-wmf.37/includes/MediaWiki.php(821): MediaWiki->restInPeace()
#25 /srv/mediawiki/php-1.36.0-wmf.37/includes/MediaWiki.php(833): MediaWiki->{closure}()
#26 /srv/mediawiki/php-1.36.0-wmf.37/api.php(125): MediaWiki->doPostOutputShutdown()
#27 /srv/mediawiki/php-1.36.0-wmf.37/api.php(45): wfApiMain()
#28 /srv/mediawiki/w/api.php(3): require(string)
#29 {main}
Impact

We seem to leave something in the DB layer in an odd / unexpected state
The logspam comes form https://gerrit.wikimedia.org/g/mediawiki/core/+/494f15438182a706094784c0c7a5ffe9bf478263/includes/libs/rdbms/database/Database.php#1530
Seemingly just calling $this->exceptionHandler->handleException is not the right / only thing we need to do, but the DB layer needs to be put in some better state when we would encounter this initial lock?

	public function doUpdate() {
		try {
			( $this->doUpdateFunction )( ...$this->arguments );
		} catch ( Exception $ex ) {
			$this->exceptionHandler->handleException( $ex, 'data-update-failed',
				'A data update callback triggered an exception' );
		}
	}
Notes

Details

Request ID
176a8ee3-cfd9-4432-b1e6-bed1a5bc3add
Request URL
https://www.wikidata.org/w/api.php
Stack Trace
from /srv/mediawiki/php-1.36.0-wmf.37/includes/debug/MWDebug.php(376)
#0 [internal function]: MWExceptionHandler::handleError(integer, string, string, integer, array)
#1 /srv/mediawiki/php-1.36.0-wmf.37/includes/debug/MWDebug.php(376): trigger_error(string, integer)
#2 /srv/mediawiki/php-1.36.0-wmf.37/includes/db/MWLBFactory.php(349): MWDebug::sendRawDeprecated(string, boolean, string)
#3 [internal function]: MWLBFactory::logDeprecation(string)
#4 /srv/mediawiki/php-1.36.0-wmf.37/includes/libs/rdbms/database/Database.php(1531): call_user_func(array, string)
#5 /srv/mediawiki/php-1.36.0-wmf.37/includes/libs/rdbms/database/Database.php(1237): Wikimedia\Rdbms\Database->assertQueryIsCurrentlyAllowed(string, string)
#6 /srv/mediawiki/php-1.36.0-wmf.37/includes/libs/rdbms/database/Database.php(4666): Wikimedia\Rdbms\Database->query(string, string, integer)
#7 /srv/mediawiki/php-1.36.0-wmf.37/includes/libs/rdbms/database/Database.php(4634): Wikimedia\Rdbms\Database->doCommit(string)
#8 /srv/mediawiki/php-1.36.0-wmf.37/includes/libs/rdbms/loadbalancer/LoadBalancer.php(1812): Wikimedia\Rdbms\Database->commit(string, string)
#9 /srv/mediawiki/php-1.36.0-wmf.37/includes/libs/rdbms/loadbalancer/LoadBalancer.php(2255): Wikimedia\Rdbms\LoadBalancer->Wikimedia\Rdbms\{closure}(Wikimedia\Rdbms\DatabaseMysqli)
#10 /srv/mediawiki/php-1.36.0-wmf.37/includes/libs/rdbms/loadbalancer/LoadBalancer.php(1817): Wikimedia\Rdbms\LoadBalancer->forEachOpenMasterConnection(Closure)
#11 /srv/mediawiki/php-1.36.0-wmf.37/includes/libs/rdbms/lbfactory/LBFactory.php(247): Wikimedia\Rdbms\LoadBalancer->commitMasterChanges(string, integer)
#12 /srv/mediawiki/php-1.36.0-wmf.37/includes/libs/rdbms/lbfactory/LBFactoryMulti.php(236): Wikimedia\Rdbms\LBFactory::Wikimedia\Rdbms\{closure}(Wikimedia\Rdbms\LoadBalancer, string, array)
#13 /srv/mediawiki/php-1.36.0-wmf.37/includes/libs/rdbms/lbfactory/LBFactory.php(249): Wikimedia\Rdbms\LBFactoryMulti->forEachLB(Closure, array)
#14 /srv/mediawiki/php-1.36.0-wmf.37/includes/libs/rdbms/lbfactory/LBFactory.php(312): Wikimedia\Rdbms\LBFactory->forEachLBCallMethod(string, array)
#15 /srv/mediawiki/php-1.36.0-wmf.37/includes/deferred/DeferredUpdates.php(515): Wikimedia\Rdbms\LBFactory->commitMasterChanges(string)
#16 /srv/mediawiki/php-1.36.0-wmf.37/includes/deferred/RefreshSecondaryDataUpdate.php(101): DeferredUpdates::attemptUpdate(Wikibase\Repo\Content\DataUpdateAdapter, Wikimedia\Rdbms\LBFactoryMulti)
#17 /srv/mediawiki/php-1.36.0-wmf.37/includes/deferred/DeferredUpdates.php(513): RefreshSecondaryDataUpdate->doUpdate()
#18 /srv/mediawiki/php-1.36.0-wmf.37/includes/deferred/DeferredUpdates.php(390): DeferredUpdates::attemptUpdate(RefreshSecondaryDataUpdate, Wikimedia\Rdbms\LBFactoryMulti)
#19 /srv/mediawiki/php-1.36.0-wmf.37/includes/deferred/DeferredUpdates.php(221): DeferredUpdates::run(RefreshSecondaryDataUpdate, Wikimedia\Rdbms\LBFactoryMulti, Monolog\Logger, BufferingStatsdDataFactory, string)
#20 /srv/mediawiki/php-1.36.0-wmf.37/includes/deferred/DeferredUpdatesScope.php(264): DeferredUpdates::{closure}(RefreshSecondaryDataUpdate, integer)
#21 /srv/mediawiki/php-1.36.0-wmf.37/includes/deferred/DeferredUpdatesScope.php(196): DeferredUpdatesScope->processStageQueue(integer, integer, Closure)
#22 /srv/mediawiki/php-1.36.0-wmf.37/includes/deferred/DeferredUpdates.php(242): DeferredUpdatesScope->processUpdates(integer, Closure)
#23 /srv/mediawiki/php-1.36.0-wmf.37/includes/MediaWiki.php(1093): DeferredUpdates::doUpdates(string)
#24 /srv/mediawiki/php-1.36.0-wmf.37/includes/MediaWiki.php(821): MediaWiki->restInPeace()
#25 /srv/mediawiki/php-1.36.0-wmf.37/includes/MediaWiki.php(833): MediaWiki->{closure}()
#26 /srv/mediawiki/php-1.36.0-wmf.37/api.php(125): MediaWiki->doPostOutputShutdown()
#27 /srv/mediawiki/php-1.36.0-wmf.37/api.php(45): wfApiMain()
#28 /srv/mediawiki/w/api.php(3): require(string)
#29 {main}

Event Timeline

The Php Deprecated part of the message comes form https://gerrit.wikimedia.org/g/mediawiki/core/+/494f15438182a706094784c0c7a5ffe9bf478263/includes/exception/MWExceptionHandler.php#251
The bulk of the rest of the messge ignored an error originally raised from comes from https://gerrit.wikimedia.org/g/mediawiki/core/+/494f15438182a706094784c0c7a5ffe9bf478263/includes/libs/rdbms/database/Database.php#1530
Seemingly a lock is encountered, and the db layer expects something extra to happen to "tidy up" the connection, instead of just handling the exception

Addshore renamed this task from False positive logspam about an (not actually) ignored error in Wikibase\Repo\Content\DataUpdateAdapter::doUpdate to Logspam about an "ignored error" in Wikibase\Repo\Content\DataUpdateAdapter::doUpdate.Apr 6 2021, 2:50 PM
Addshore updated the task description. (Show Details)

THis task talks about locks.
A possible way to try and reproduce the situation locally would be using breakpoints.
Find the location just after the lock that is being encountered, and put a breakpoint there.
Then fire up another request that is going to encounter that lock and reach this "error state"

noarave renamed this task from Logspam about an "ignored error" in Wikibase\Repo\Content\DataUpdateAdapter::doUpdate to [8h] Logspam about an "ignored error" in Wikibase\Repo\Content\DataUpdateAdapter::doUpdate.Apr 7 2021, 10:32 AM

Change 679529 had a related patch set uploaded (by Ladsgroup; author: Ladsgroup):

[mediawiki/extensions/Wikibase@master] Don't catch TermStoreException

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

Oh this is another case of catching DBErrors.
See https://www.mediawiki.org/wiki/Database_transactions#Use_of_transaction_rollback (emphasis not mine)

Callers might catch DBError exceptions without either re-throwing them or throwing their own version of the error. Doing so is extremely bad practice and can cause all sorts of problems from partial commits to simply spewing up DBTransactionError errors. Only catch DB errors in order to do some cleanup before re-throwing an error or if the database in question is used exclusively by the code catching errors.

Funnily enough, we don't catch any db error in our codebase (the only one we catch is never thrown, removing that for good measure), it's happening in core meaning this warning will likely continue to pop up in different shape and form for different extensions or basically anything that does sql queries in deferred updates.

oh my bad, we do catch db errors in DataUpdateAdapter, I thought it's a core class. Making a patch now.

Change 679533 had a related patch set uploaded (by Ladsgroup; author: Ladsgroup):

[mediawiki/extensions/Wikibase@master] Re-throw DBErrors in DataUpdateAdapter

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

Change 679533 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Re-throw DBErrors in DataUpdateAdapter

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

Change 721529 had a related patch set uploaded (by Addshore; author: Ladsgroup):

[mediawiki/extensions/Wikibase@REL1_36] Re-throw DBErrors in DataUpdateAdapter

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

Change 721529 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@REL1_36] Re-throw DBErrors in DataUpdateAdapter

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

Change 679529 abandoned by Silvan Heintze:

[mediawiki/extensions/Wikibase@master] Don't catch TermStoreException

Reason:

old and resolved otherwise

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