Page MenuHomePhabricator

[Bug] File deletion problem on commons.wikimedia.org
Closed, ResolvedPublicPRODUCTION ERROR

Description

As a commons admin I try to delete https://commons.wikimedia.org/wiki/File:Fran%C3%A7ois-Joseph_Gossac.jpeg. A file with a wrong written filename and duplicate to File:François-Joseph Gossec.jpeg. The deletion call results reproducible in a very sparse error message: (html source code)

<html><head></head><body>Exception encountered, of type "Wikibase\Client\Usage\UsageTrackerException" </body></html>

See also:

Event Timeline

Restricted Application added a subscriber: Poyekhali. · View Herald Transcript
Krenair subscribed.
2016-05-17 14:04:04 [Vzsk1ApAIDkAABQShV0AAAAQ] mw1187 commonswiki 1.28.0-wmf.1 exception ERROR: [Vzsk1ApAIDkAABQShV0AAAAQ] /w/index.php?title=File:August_Kierspel.jpg&action=delete   Wikibase\Client\Usage\UsageTrackerException from line 227 of /srv/mediawiki/php-1.28.0-wmf.1/extensions/Wikidata/extensions/Wikibase/client/includes/Usage/Sql/SqlUsageTracker.php: Got explicit BEGIN from Wikibase\Client\Usage\Sql\EntityUsageTable::removeUsages while atomic section(s) FileDeleteForm::doDelete are open. {"exception_id":"Vzsk1ApAIDkAABQShV0AAAAQ"} 
[Exception Wikibase\Client\Usage\UsageTrackerException] (/srv/mediawiki/php-1.28.0-wmf.1/extensions/Wikidata/extensions/Wikibase/client/includes/Usage/Sql/SqlUsageTracker.php:227) Got explicit BEGIN from Wikibase\Client\Usage\Sql\EntityUsageTable::removeUsages while atomic section(s) FileDeleteForm::doDelete are open.
  #0 /srv/mediawiki/php-1.28.0-wmf.1/extensions/Wikidata/extensions/Wikibase/client/includes/Store/UsageUpdater.php(134): Wikibase\Client\Usage\Sql\SqlUsageTracker->pruneUsages(integer)
  #1 /srv/mediawiki/php-1.28.0-wmf.1/extensions/Wikidata/extensions/Wikibase/client/includes/Hooks/DataUpdateHookHandlers.php(177): Wikibase\Client\Store\UsageUpdater->pruneUsagesForPage(integer)
  #2 /srv/mediawiki/php-1.28.0-wmf.1/extensions/Wikidata/extensions/Wikibase/client/includes/Hooks/DataUpdateHookHandlers.php(88): Wikibase\Client\Hooks\DataUpdateHookHandlers->doArticleDeleteComplete(integer, integer)
  #3 /srv/mediawiki/php-1.28.0-wmf.1/includes/Hooks.php(195): Wikibase\Client\Hooks\DataUpdateHookHandlers::onArticleDeleteComplete(WikiFilePage, User, string, integer, WikitextContent, ManualLogEntry)
  #4 /srv/mediawiki/php-1.28.0-wmf.1/includes/page/WikiPage.php(2925): Hooks::run(string, array)
  #5 /srv/mediawiki/php-1.28.0-wmf.1/includes/FileDeleteForm.php(196): WikiPage->doDeleteArticleReal(string, boolean, integer, boolean, string, User)
  #6 /srv/mediawiki/php-1.28.0-wmf.1/includes/FileDeleteForm.php(120): FileDeleteForm::doDelete(Title, LocalFile, string, string, boolean, User)
  #7 /srv/mediawiki/php-1.28.0-wmf.1/includes/page/ImagePage.php(999): FileDeleteForm->execute()
  #8 /srv/mediawiki/php-1.28.0-wmf.1/includes/actions/DeleteAction.php(54): ImagePage->delete()
  #9 /srv/mediawiki/php-1.28.0-wmf.1/includes/MediaWiki.php(503): DeleteAction->show()
  #10 /srv/mediawiki/php-1.28.0-wmf.1/includes/MediaWiki.php(288): MediaWiki->performAction(ImagePage, Title)
  #11 /srv/mediawiki/php-1.28.0-wmf.1/includes/MediaWiki.php(745): MediaWiki->performRequest()
  #12 /srv/mediawiki/php-1.28.0-wmf.1/includes/MediaWiki.php(519): MediaWiki->main()
  #13 /srv/mediawiki/php-1.28.0-wmf.1/index.php(43): MediaWiki->run()
  #14 /srv/mediawiki/w/index.php(3): include(string)
  #15 {main}
Caused by: [Exception DBUnexpectedError] (/srv/mediawiki/php-1.28.0-wmf.1/includes/db/Database.php:2588) Got explicit BEGIN from Wikibase\Client\Usage\Sql\EntityUsageTable::removeUsages while atomic section(s) FileDeleteForm::doDelete are open.
  #0 /srv/mediawiki/php-1.28.0-wmf.1/extensions/Wikidata/extensions/Wikibase/client/includes/Usage/Sql/EntityUsageTable.php(251): DatabaseBase->begin(string)
  #1 /srv/mediawiki/php-1.28.0-wmf.1/extensions/Wikidata/extensions/Wikibase/client/includes/Usage/Sql/EntityUsageTable.php(228): Wikibase\Client\Usage\Sql\EntityUsageTable->removeUsages(integer, array)
  #2 /srv/mediawiki/php-1.28.0-wmf.1/extensions/Wikidata/extensions/Wikibase/client/includes/Usage/Sql/SqlUsageTracker.php(219): Wikibase\Client\Usage\Sql\EntityUsageTable->pruneUsages(integer)
  #3 /srv/mediawiki/php-1.28.0-wmf.1/extensions/Wikidata/extensions/Wikibase/client/includes/Store/UsageUpdater.php(134): Wikibase\Client\Usage\Sql\SqlUsageTracker->pruneUsages(integer)
  #4 /srv/mediawiki/php-1.28.0-wmf.1/extensions/Wikidata/extensions/Wikibase/client/includes/Hooks/DataUpdateHookHandlers.php(177): Wikibase\Client\Store\UsageUpdater->pruneUsagesForPage(integer)
  #5 /srv/mediawiki/php-1.28.0-wmf.1/extensions/Wikidata/extensions/Wikibase/client/includes/Hooks/DataUpdateHookHandlers.php(88): Wikibase\Client\Hooks\DataUpdateHookHandlers->doArticleDeleteComplete(integer, integer)
  #6 /srv/mediawiki/php-1.28.0-wmf.1/includes/Hooks.php(195): Wikibase\Client\Hooks\DataUpdateHookHandlers::onArticleDeleteComplete(WikiFilePage, User, string, integer, WikitextContent, ManualLogEntry)
  #7 /srv/mediawiki/php-1.28.0-wmf.1/includes/page/WikiPage.php(2925): Hooks::run(string, array)
  #8 /srv/mediawiki/php-1.28.0-wmf.1/includes/FileDeleteForm.php(196): WikiPage->doDeleteArticleReal(string, boolean, integer, boolean, string, User)
  #9 /srv/mediawiki/php-1.28.0-wmf.1/includes/FileDeleteForm.php(120): FileDeleteForm::doDelete(Title, LocalFile, string, string, boolean, User)
  #10 /srv/mediawiki/php-1.28.0-wmf.1/includes/page/ImagePage.php(999): FileDeleteForm->execute()
  #11 /srv/mediawiki/php-1.28.0-wmf.1/includes/actions/DeleteAction.php(54): ImagePage->delete()
  #12 /srv/mediawiki/php-1.28.0-wmf.1/includes/MediaWiki.php(503): DeleteAction->show()
  #13 /srv/mediawiki/php-1.28.0-wmf.1/includes/MediaWiki.php(288): MediaWiki->performAction(ImagePage, Title)
  #14 /srv/mediawiki/php-1.28.0-wmf.1/includes/MediaWiki.php(745): MediaWiki->performRequest()
  #15 /srv/mediawiki/php-1.28.0-wmf.1/includes/MediaWiki.php(519): MediaWiki->main()
  #16 /srv/mediawiki/php-1.28.0-wmf.1/index.php(43): MediaWiki->run()
  #17 /srv/mediawiki/w/index.php(3): include(string)
  #18 {main}
Lydia_Pintscher renamed this task from File deletion problem on commons.wikimedia.org to [Bug] File deletion problem on commons.wikimedia.org.May 19 2016, 12:08 PM
Lydia_Pintscher triaged this task as High priority.
Lydia_Pintscher moved this task from incoming to ready to go on the Wikidata board.

I probably caused this with b27c48569bf9e8fbd8754b451821d2a4e2e70910, investigating on how to continue here.

I probably caused this with b27c48569bf9e8fbd8754b451821d2a4e2e70910, investigating on how to continue here.

We have a few possible ways to solve this here: We could use DatabaseBase::onTransactionIdle for deleting the entity usage rows in question or just revert b27c48569bf9e8fbd8754b451821d2a4e2e70910, not sure what's more desirable.

Using onTransactionIdle would shorten the transaction started from FileDeleteForm::doDelete.

Alternatively we could create a dedicated job type for this, or do the deletions via a DataUpdate injected via the WikiPageDeletionUpdates hook.

Maybe @daniel or @aaron have an opinion?

If the # of rows it might delete has no sane upper bound, then it should be a job. If it's just 100s at most, then it could use a DeferredUpdate class IMO.

matmarex subscribed.

This sounds like it makes it impossible to delete any file that is referenced from a Wikidata entity? If so, I would consider it UBN priority.

aaron raised the priority of this task from High to Unbreak Now!.May 22 2016, 9:53 PM

I'll look into this in a bit, didn't realize this was such a widespread problem.

Change 290148 had a related patch set uploaded (by Hoo man):
Use DeferredUpdates in DataUpdateHookHandlers for deletions

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

Change 290216 had a related patch set uploaded (by Aude):
Use DeferredUpdates in DataUpdateHookHandlers for deletions

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

Change 290148 merged by jenkins-bot:
Use DeferredUpdates in DataUpdateHookHandlers for deletions

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

Change 290216 merged by jenkins-bot:
Use DeferredUpdates in DataUpdateHookHandlers for deletions

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

aude removed a project: Patch-For-Review.
mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:10 PM