Page MenuHomePhabricator

AutoCommitUpdate::doUpdate (Title->invalidateCache) causes Exception thrown with an uncommited database transaction
Closed, ResolvedPublic

Description

MediaWiki 1.29.0-alpha (54381ead)
PHP	5.6.8 (apache2handler)
MySQL	5.6.24
ICU	54.1

Issue

We used to send a Title::invalidateCache when an UpdateJob was finished (and this worked til 1.28) but now AutoCommitUpdate (instead of onTransactionIdle) is causing:

[Bug56269] Exception thrown with an uncommited database transaction: [1942fa34c3a7358678fe4377] /mw-master/index.php/Main_Page   DBTransactionError from line 193 of ...\mw-master\includes\libs\rdbms\lbfactory\LBFactory.php: AutoCommitUpdate::doUpdate: transaction round 'SMW\MediaWiki\Jobs\UpdateJob::run' already started.
#0 ...\mw-master\includes\deferred\DeferredUpdates.php(262): LBFactory->beginMasterChanges(string)
#1 ...\mw-master\includes\deferred\DeferredUpdates.php(225): DeferredUpdates::runUpdate(AutoCommitUpdate, LBFactorySimple, integer)
#2 ...\mw-master\includes\deferred\DeferredUpdates.php(129): DeferredUpdates::execute(array, string, integer)
#3 ...\mw-master\includes\deferred\DeferredUpdates.php(92): DeferredUpdates::doUpdates(string)
#4 ...\mw-master\includes\Title.php(4425): DeferredUpdates::addUpdate(AutoCommitUpdate, integer)
#5 ...\mw-master\extensions\SemanticMediaWiki\src\MediaWiki\PageUpdater.php(50): Title->invalidateCache()
#6 ...\mw-master\extensions\SemanticMediaWiki\src\MediaWiki\Jobs\ParserCachePurgeJob.php(81): SMW\MediaWiki\PageUpdater->doPurgeParserCache()
... 
#25 ...\mw-master\extensions\SemanticMediaWiki\src\MediaWiki\Jobs\UpdateJob.php(170): SMW\ParserData->updateStore()
#26 ...\mw-master\extensions\SemanticMediaWiki\src\MediaWiki\Jobs\UpdateJob.php(134): SMW\MediaWiki\Jobs\UpdateJob->updateStore(SMW\ParserData)
#27 ...\mw-master\extensions\SemanticMediaWiki\src\MediaWiki\Jobs\UpdateJob.php(106): SMW\MediaWiki\Jobs\UpdateJob->needToParsePageContentBeforeUpdate()
#28 ...\mw-master\extensions\SemanticMediaWiki\src\MediaWiki\Jobs\UpdateJob.php(75): SMW\MediaWiki\Jobs\UpdateJob->doPrepareForUpdate()
#29 ...\mw-master\extensions\SemanticMediaWiki\src\MediaWiki\Jobs\UpdateJob.php(61): SMW\MediaWiki\Jobs\UpdateJob->doUpdate()
#30 ...\mw-master\includes\jobqueue\JobRunner.php(286): SMW\MediaWiki\Jobs\UpdateJob->run()
#31 ...\mw-master\includes\jobqueue\JobRunner.php(186): JobRunner->executeJob(SMW\MediaWiki\Jobs\UpdateJob, LBFactorySimple, BufferingStatsdDataFactory, integer)
#32 ...\mw-master\includes\MediaWiki.php(941): JobRunner->run(array)
#33 ...\mw-master\includes\MediaWiki.php(900): MediaWiki->triggerJobs()
#34 ...\mw-master\includes\MediaWiki.php(720): MediaWiki->restInPeace(string)
#35 ...\mw-master\includes\MediaWiki.php(739): MediaWiki->{closure}()
#36 ...\mw-master\includes\MediaWiki.php(543): MediaWiki->doPostOutputShutdown(string)
#37 ...\mw-master\index.php(43): MediaWiki->run(

Event Timeline

Given the following message [0], are we going to address (which implicitly means solve) this with 1.29?

[0] https://lists.wikimedia.org/pipermail/wikitech-l/2017-April/088019.html

Given the following message [0], are we going to address (which implicitly means solve) this with 1.29?

Any fix for this report should probably be backported to REL1_29. However if you want more developer attention for this bug and/or you object to a 1.29 release without a fix for this bug then you should reply to that wikitech-l message.

Very similar to T154438 and T154425 , should be checked after resolution of the other bug, or closed as a duplicate.

In fact I do no more think it is the same as T154438 and T154425 but instead a true duplicate of T165714: I have SMW installed on my test wiki and it does not trigger exceptions (I have the patch https://gerrit.wikimedia.org/r/#/c/356120/ applied) -- I didn’t notice these exception before applying the patch but perhaps I missed these. A difference with the two other tasks is: the two others call DeferredUpdates::doUpdates directly from MediaWiki::restInPeace, but this task call DeferredUpdates::doUpdates after a call from DeferredUpdates::addUpdate from a job, so I’m pretty sure this will be solved with the gerrit patch.

@mwjames Can you apply https://gerrit.wikimedia.org/r/#/c/356120/ on your MediaWiki installation and re-test this specific bug and T165714?

so I’m pretty sure this will be solved with the gerrit patch.
... and re-test this specific bug ...

Let's assume that changes between 1.29.0-alpha (54381ead, Jan 2 2017) and [0] have somehow addressed this issue.

[0] https://github.com/wikimedia/mediawiki/commit/7f65646f35fca0544e6fc388f884bfedcb9a8948

Krinkle claimed this task.
Krinkle triaged this task as High priority.
Krinkle added a subscriber: Krinkle.

Fixed by https://gerrit.wikimedia.org/r/#/c/356120/. See T100085 for more information.