[go: up one dir, main page]

Page MenuHomePhabricator

Expected mass rollback of all peer transactions (DBO_TRX set)
Open, Needs TriagePublic

Description

Flow has some error handling code that looks like this:

try {
    // stuff
} catch ( \Exception $e ) {
    $state->rollback();
    \MWExceptionHandler::logException( $e );
}

When //stuff fails I get (on labs-vagrant, when using Special:EnableStructuredDiscussions to convert an existing page)

2018-06-14 12:05:53 mcr-full wiki: [0d80dda1d86880078da1e67b] /wiki/Special:EnableStructuredDiscussions   Wikimedia\Rdbms\DBUnexpectedError from line 3884 of /vagrant/mediawiki/includes/libs/rdbms/database/Database.php: Flow\Import\PageImportState::rollback: Expected mass rollback of all peer transactions (DBO_TRX set).
#0 /vagrant/mediawiki/extensions/Flow/includes/Import/Importer.php(416): Wikimedia\Rdbms\Database->rollback(string)
#1 /vagrant/mediawiki/extensions/Flow/includes/Import/Importer.php(598): Flow\Import\PageImportState->rollback()
#2 /vagrant/mediawiki/extensions/Flow/includes/Import/Importer.php(126): Flow\Import\TalkpageImportOperation->import(Flow\Import\PageImportState)
#3 /vagrant/mediawiki/extensions/Flow/includes/Import/Converter.php(187): Flow\Import\Importer->import(Flow\Import\Wikitext\ImportSource, Title, User, Flow\Import\SourceStore\NullImportSourceStore)
#4 /vagrant/mediawiki/extensions/Flow/includes/Import/Converter.php(138): Flow\Import\Converter->doConversion(Title, NULL)
#5 /vagrant/mediawiki/extensions/Flow/includes/Specials/SpecialEnableStructuredDiscussions.php(120): Flow\Import\Converter->convert(Title)
#6 /vagrant/mediawiki/includes/htmlform/HTMLForm.php(662): Flow\Specials\SpecialEnableStructuredDiscussions->onSubmit(array, OOUIHTMLForm)
#7 /vagrant/mediawiki/includes/htmlform/HTMLForm.php(554): HTMLForm->trySubmit()
#8 /vagrant/mediawiki/includes/htmlform/HTMLForm.php(569): HTMLForm->tryAuthorizedSubmit()
#9 /vagrant/mediawiki/includes/specialpage/FormSpecialPage.php(184): HTMLForm->show()
#10 /vagrant/mediawiki/extensions/Flow/includes/Specials/SpecialEnableStructuredDiscussions.php(49): FormSpecialPage->execute(NULL)
#11 /vagrant/mediawiki/includes/specialpage/SpecialPage.php(565): Flow\Specials\SpecialEnableStructuredDiscussions->execute(NULL)
#12 /vagrant/mediawiki/includes/specialpage/SpecialPageFactory.php(569): SpecialPage->run(NULL)
#13 /vagrant/mediawiki/includes/MediaWiki.php(288): SpecialPageFactory::executePath(Title, RequestContext)
#14 /vagrant/mediawiki/includes/MediaWiki.php(867): MediaWiki->performRequest()
#15 /vagrant/mediawiki/includes/MediaWiki.php(524): MediaWiki->main()
#16 /vagrant/mediawiki/index.php(42): MediaWiki->run()
#17 /var/www/w/index.php(5): include(string)

which is not so helpful.

Not sure if this is a problem with Flow or the DB abstraction layer; ideally, though, logging would happen before rollback, and Database::rollback would be very conservative about throwing exceptions as they are likely to mess up error logging / recovery.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

FWIW the original exception was

2018-06-14 12:22:38 mcr-full wiki: [a9d24b56be842208db86ddac] /wiki/Special:EnableStructuredDiscussions   Wikimedia\Rdbms\DBUnexpectedError from line 3754 of /vagrant/mediawiki/includes/libs/rdbms/database/Database.php: Flow\Import\PageImportState::begin: Implicit transaction already active (from Wikimedia\Rdbms\Database::query (User::idFromName)).
#0 /vagrant/mediawiki/extensions/Flow/includes/Import/Importer.php(406): Wikimedia\Rdbms\Database->begin(string)
#1 /vagrant/mediawiki/extensions/Flow/includes/Import/Importer.php(586): Flow\Import\PageImportState->begin()
#2 /vagrant/mediawiki/extensions/Flow/includes/Import/Importer.php(126): Flow\Import\TalkpageImportOperation->import(Flow\Import\PageImportState)
#3 /vagrant/mediawiki/extensions/Flow/includes/Import/Converter.php(187): Flow\Import\Importer->import(Flow\Import\Wikitext\ImportSource, Title, User, Flow\Import\SourceStore\NullImportSourceStore)
#4 /vagrant/mediawiki/extensions/Flow/includes/Import/Converter.php(138): Flow\Import\Converter->doConversion(Title, NULL)
#5 /vagrant/mediawiki/extensions/Flow/includes/Specials/SpecialEnableStructuredDiscussions.php(120): Flow\Import\Converter->convert(Title)
#6 /vagrant/mediawiki/includes/htmlform/HTMLForm.php(662): Flow\Specials\SpecialEnableStructuredDiscussions->onSubmit(array, OOUIHTMLForm)
#7 /vagrant/mediawiki/includes/htmlform/HTMLForm.php(554): HTMLForm->trySubmit()
#8 /vagrant/mediawiki/includes/htmlform/HTMLForm.php(569): HTMLForm->tryAuthorizedSubmit()
#9 /vagrant/mediawiki/includes/specialpage/FormSpecialPage.php(184): HTMLForm->show()
#10 /vagrant/mediawiki/extensions/Flow/includes/Specials/SpecialEnableStructuredDiscussions.php(49): FormSpecialPage->execute(NULL)
#11 /vagrant/mediawiki/includes/specialpage/SpecialPage.php(565): Flow\Specials\SpecialEnableStructuredDiscussions->execute(NULL)
#12 /vagrant/mediawiki/includes/specialpage/SpecialPageFactory.php(569): SpecialPage->run(NULL)
#13 /vagrant/mediawiki/includes/MediaWiki.php(288): SpecialPageFactory::executePath(Title, RequestContext)
#14 /vagrant/mediawiki/includes/MediaWiki.php(867): MediaWiki->performRequest()
#15 /vagrant/mediawiki/includes/MediaWiki.php(524): MediaWiki->main()
#16 /vagrant/mediawiki/index.php(42): MediaWiki->run()
#17 /var/www/w/index.php(5): include(string)
#18 {main}

Probably a case of using Database::begin instead of Database::startAtomic (see docs).

I believe this is because it wants you to roll back all DBs at once, not just the Flow DB. We'll have to look at how this was done elsewhere.

Vvjjkkii renamed this task from Expected mass rollback of all peer transactions (DBO_TRX set) to l0aaaaaaaa.Jul 1 2018, 1:04 AM
Vvjjkkii triaged this task as High priority.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed a subscriber: Aklapper.
CommunityTechBot renamed this task from l0aaaaaaaa to Expected mass rollback of all peer transactions (DBO_TRX set).Jul 2 2018, 6:46 AM
CommunityTechBot raised the priority of this task from High to Needs Triage.
CommunityTechBot updated the task description. (Show Details)
CommunityTechBot added a subscriber: Aklapper.

Just saw this in some new transaction handling I added for the SMW extension. The logic I added looks similar to @Tgr's example from Flow.

For reference, I'm seeing this on a single database system that is implemented in a Percona cluster.