Last modified: 2014-04-06 09:12:11 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T65145, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 63145 - Referential integrity issues on commons on pages created by API
Referential integrity issues on commons on pages created by API
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
unspecified
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-03-26 21:16 UTC by Bawolff (Brian Wolff)
Modified: 2014-04-06 09:12 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Bawolff (Brian Wolff) 2014-03-26 21:16:55 UTC
These pages https://dpaste.de/Df0x/raw (except for things in namespace 6, which is bug 32551. However that's basically the same bug except for from the runJobs.php entry point instead of api.php entry point)

There's a bunch of pages on commons with no revisions and rev_latest = 0.

I suspect this is caused by differences in uncaught exception handling on the api.php entry point and the index.php entry point.


If there is an open transaction, and then an exception is thrown, but nobody catches it, different things will happen depending  on entry point:
*On index.php, transaction will be thrown away (implicitly anyways, basically the shutdown method isn't called)
*On Api.php the following:
$lb = wfGetLBFactory();
$lb->shutdown();

Happens regardless of if there is an uncaught exception, triggering a $dbw->commit even if exception was thrown in middle of transaction.
Comment 1 Tomasz W. Kozlowski 2014-03-26 21:19:22 UTC
This also appears to be happening on wikis other than Commons, though on a much more limited scale than on Commons (one page on frwiki, for instance).
Comment 2 Brad Jorsch 2014-03-27 16:49:37 UTC
(In reply to Bawolff (Brian Wolff) from comment #0)
> *On index.php, transaction will be thrown away (implicitly anyways,
> basically the shutdown method isn't called)

That is probably what's behind bug 56269.

> Happens regardless of if there is an uncaught exception, triggering a
> $dbw->commit even if exception was thrown in middle of transaction.

Yeah, that's no good.

Of course, in both this bug and bug 56269 the real solution is that whatever is opening these transactions should catch, rollback, and rethrow. But uncaught exceptions happen, so the last-resort catch should DTRT and both rollback and log the stack trace of the problematic exception.
Comment 3 Gerrit Notification Bot 2014-03-27 16:49:55 UTC
Change 121402 had a related patch set uploaded by Anomie:
Improve handling of uncommitted DB txns with "uncaught" exceptions

https://gerrit.wikimedia.org/r/121402
Comment 4 Gerrit Notification Bot 2014-03-31 16:30:41 UTC
Change 121402 merged by jenkins-bot:
Improve handling of uncommitted DB txns with "uncaught" exceptions

https://gerrit.wikimedia.org/r/121402
Comment 5 Brad Jorsch 2014-03-31 18:49:16 UTC
This should be deployed to WMF wikis with 1.23wmf21, see https://www.mediawiki.org/wiki/MediaWiki_1.23/Roadmap for the schedule.
Comment 6 Gerrit Notification Bot 2014-04-06 02:22:45 UTC
Change 124137 had a related patch set uploaded by Brian Wolff:
Make doEditContent call $dbw->rollback() if exception happens

https://gerrit.wikimedia.org/r/124137
Comment 7 Bawolff (Brian Wolff) 2014-04-06 02:28:37 UTC
(In reply to Gerrit Notification Bot from comment #6)
> Change 124137 had a related patch set uploaded by Brian Wolff:
> Make doEditContent call $dbw->rollback() if exception happens
> 
> https://gerrit.wikimedia.org/r/124137

This patch is related to making certain things more robust, but ultimately this bug is already fixed, so resetting to fixed.
Comment 8 Gerrit Notification Bot 2014-04-06 09:12:11 UTC
Change 124137 merged by jenkins-bot:
Make doEditContent call $dbw->rollback() if exception happens

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

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links