Page MenuHomePhabricator

"Edit conflict" when approving two or more tags for a specific image
Closed, ResolvedPublicBUG REPORT

Description

In general, CAT allows a user to approve any or all suggested tags for an image, and adds all approved tags as Depicts statements. However, for at least one image, approving any two or more suggested tags causes MediaWiki to detect an edit conflict when attempting to add Depicts statements. The problem is reproducible on both Commons and Test Commons for this specific image, and happens regardless of the logged-in user.

https://commons.wikimedia.org/wiki/File:Malibu-superbloom.jpg
https://test-commons.wikimedia.org/wiki/File:Malibu-superbloom-redux.jpg (deleted for testing)

After adding some logging, the error Status coming back from the revision save attempt is coming back with a value of EditEntity::SAVE_ERROR (8), which appears to indicate that a StorageException was thrown while calling $this->entityStore->saveEntity() on L722 of MediawikiEditEntity.php. The error Status also has the message edit-conflict, which indicates that the StorageException in question is the one at L357 of WikiPageEntityStore.php. But there is no apparent reason that the edit conflict check there should consistently fail for this specific file.

Event Timeline

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

I'll poke my head in from vacationland to say one quick thing: I don't know what to make of the filename business, but one particular area I suspect may be causing trouble is how we're creating and saving multiple revisions in series in the course of handling a single API request. Maybe the expected latest revision ID for the entity is retrieved from a DB replica at one point and from master at another, causing a race condition vs. replication of the relevant table updates after a revision is saved?

If it's helpful, I have a WIP patch going here to update Depicts setting to use the wbsetclaim API module (which necessarily involves updating to make one revision per API request) but I didn't get a chance to wrap it up before vacation time.

https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/MachineVision/+/559345/

Change 565614 had a related patch set uploaded (by Cparle; owner: Cparle):
[operations/mediawiki-config@master] Remove handler deleted from the MachineVision extension

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

Change 559345 had a related patch set uploaded (by Cparle; owner: Michael Holloway):
[mediawiki/extensions/MachineVision@master] Use the wbsetclaim API to add depicts statements

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

Change 565987 had a related patch set uploaded (by Cparle; owner: Cparle):
[operations/mediawiki-config@master] Remove handler deleted from the MachineVision extension on beta

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

Change 559345 merged by jenkins-bot:
[mediawiki/extensions/MachineVision@master] Use the wbsetclaim API to add depicts statements

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

Change 566833 had a related patch set uploaded (by Jforrester; owner: Michael Holloway):
[mediawiki/extensions/MachineVision@wmf/1.35.0-wmf.16] Use the wbsetclaim API to add depicts statements

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

Change 565987 merged by jenkins-bot:
[operations/mediawiki-config@master] Remove handler deleted from the MachineVision extension on beta

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

Change 566833 merged by Matthias Mullie:
[mediawiki/extensions/MachineVision@wmf/1.35.0-wmf.16] Use the wbsetclaim API to add depicts statements

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

Change 565614 merged by jenkins-bot:
[operations/mediawiki-config@master] Remove handler deleted from the MachineVision extension

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

Change 566859 had a related patch set uploaded (by Matthias Mullie; owner: Matthias Mullie):
[operations/mediawiki-config@master] Remove handler deleted from the MachineVision extension on beta

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

Change 566860 had a related patch set uploaded (by Matthias Mullie; owner: Matthias Mullie):
[operations/mediawiki-config@master] Remove handler deleted from the MachineVision extension

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

Change 566880 had a related patch set uploaded (by Matthias Mullie; owner: Matthias Mullie):
[mediawiki/extensions/MachineVision@master] Use the wbsetclaim API to add depicts statements

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

Change 566880 had a related patch set uploaded (by Cparle; owner: Michael Holloway):
[mediawiki/extensions/MachineVision@master] Use the wbsetclaim API to add depicts statements

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

Change 570286 had a related patch set uploaded (by Matthias Mullie; owner: Michael Holloway):
[mediawiki/extensions/MachineVision@wmf/1.35.0-wmf.18] Use the wbsetclaim API to add depicts statements

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

Change 566880 merged by jenkins-bot:
[mediawiki/extensions/MachineVision@master] Use the wbsetclaim API to add depicts statements

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

Change 566859 merged by Mholloway:
[operations/mediawiki-config@master] Remove handler deleted from the MachineVision extension on beta

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

Change 570286 merged by jenkins-bot:
[mediawiki/extensions/MachineVision@wmf/1.35.0-wmf.18] Use the wbsetclaim API to add depicts statements

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

Change 566860 merged by jenkins-bot:
[operations/mediawiki-config@master] Remove handler deleted from the MachineVision extension

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

This....kind of worked. On the Superbloom image I still got a "Something went wrong" message, but the tag submission still went through (for the first time, after months of failure). Further testing needed, but making progress.

Upon further testing, although the image was able to proceed through the whole UI flow after I added several tags, those tags did not appear on the file itself as depicts statements (the file does have 1 existing depicts statement on it, but that shouldn't have caused an error, as there was no tag value collision)

Change 570932 had a related patch set uploaded (by Mholloway; owner: Michael Holloway):
[mediawiki/extensions/MachineVision@wmf/1.35.0-wmf.16] Use the wbsetclaim API to add depicts statements

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

Change 570932 merged by jenkins-bot:
[mediawiki/extensions/MachineVision@wmf/1.35.0-wmf.16] Use the wbsetclaim API to add depicts statements

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

Mentioned in SAL (#wikimedia-operations) [2020-02-10T12:28:53Z] <urbanecm@deploy1001> Started scap: SWAT: 799224f: 137a40e (T241242; T243974)

Mentioned in SAL (#wikimedia-operations) [2020-02-10T12:49:11Z] <urbanecm@deploy1001> Finished scap: SWAT: 799224f: 137a40e (T241242; T243974) (duration: 20m 18s)

The Android team is currently working on a feature consuming these APIs, so please announce any further MachineVision API changes at Scrum of Scrums and/or give the Android team (cc @Dbrant) a courtesy heads-up!

Note: we are now adding depicts statements ourselves using the wbsetclaim API directly, so we no longer expect the reviewimagelabels API to do this.

Change 574075 had a related patch set uploaded (by Mholloway; owner: Michael Holloway):
[mediawiki/extensions/MachineVision@master] Mark reviewimagelabels internal; unmark unreviewedimagecount

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

Verified to be working on personal uploads on production.

Change 574075 merged by jenkins-bot:
[mediawiki/extensions/MachineVision@master] Mark reviewimagelabels internal; unmark unreviewedimagecount

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