Page MenuHomePhabricator

Internal error while undoing file captions: "InvalidArgumentException: Unsaved revision passed"
Closed, ResolvedPublic

Description

While undoing file captions I get internal error, e.g. in case of undoing this change I got [XbCuwQpAICwAAK60wekAAACP] 2019-10-23 19:49:21: Fatal exception of type "InvalidArgumentException". Tested on three different files, seems to be very fresh issue. Rollbacking works as expected.

2019-10-23 19:49:21 [XbCuwQpAICwAAK60wekAAACP] mw1323 commonswiki 1.35.0-wmf.3 exception ERROR: [XbCuwQpAICwAAK60wekAAACP] /w/index.php?title=File:Scorpio2.jpg&action=mcrundo&undo=367895766&undoafter=345858690&uselang=en   InvalidArgumentException from line 3276 of /srv/mediawiki/php-1.35.0-wmf.3/includes/Revision/RevisionStore.php: Unsaved revision passed {"exception_id":"XbCuwQpAICwAAK60wekAAACP","exception_url":"/w/index.php?title=File:Scorpio2.jpg&action=mcrundo&undo=367895766&undoafter=345858690&uselang=en","caught_by":"mwe_handler"} 
[Exception InvalidArgumentException] (/srv/mediawiki/php-1.35.0-wmf.3/includes/Revision/RevisionStore.php:3276) Unsaved revision passed
  #0 /srv/mediawiki/php-1.35.0-wmf.3/includes/diff/DifferenceEngine.php(1470): MediaWiki\Revision\RevisionStore->countRevisionsBetween(MediaWiki\Revision\MutableRevisionRecord, MediaWiki\Revision\RevisionStoreCacheRecord, integer)
  #1 /srv/mediawiki/php-1.35.0-wmf.3/includes/diff/DifferenceEngine.php(998): DifferenceEngine->getMultiNotice()
  #2 /srv/mediawiki/php-1.35.0-wmf.3/includes/actions/McrUndoAction.php(242): DifferenceEngine->getDiff(string, string)
  #3 /srv/mediawiki/php-1.35.0-wmf.3/includes/actions/McrUndoAction.php(374): McrUndoAction->generateDiffOrPreview()
  #4 /srv/mediawiki/php-1.35.0-wmf.3/includes/htmlform/fields/HTMLInfoField.php(25): McrUndoAction->{closure}(array)
  #5 /srv/mediawiki/php-1.35.0-wmf.3/includes/htmlform/HTMLForm.php(1699): HTMLInfoField->getDefault()
  #6 /srv/mediawiki/php-1.35.0-wmf.3/includes/htmlform/HTMLForm.php(1299): HTMLForm->displaySection(array, string)
  #7 /srv/mediawiki/php-1.35.0-wmf.3/includes/htmlform/OOUIHTMLForm.php(254): HTMLForm->getBody()
  #8 /srv/mediawiki/php-1.35.0-wmf.3/includes/htmlform/HTMLForm.php(1076): OOUIHTMLForm->getBody()
  #9 /srv/mediawiki/php-1.35.0-wmf.3/includes/htmlform/HTMLForm.php(1055): HTMLForm->getHTML(boolean)
  #10 /srv/mediawiki/php-1.35.0-wmf.3/includes/htmlform/HTMLForm.php(606): HTMLForm->displayForm(boolean)
  #11 /srv/mediawiki/php-1.35.0-wmf.3/includes/actions/FormAction.php(143): HTMLForm->show()
  #12 /srv/mediawiki/php-1.35.0-wmf.3/includes/actions/McrUndoAction.php(90): FormAction->show()
  #13 /srv/mediawiki/php-1.35.0-wmf.3/includes/MediaWiki.php(514): McrUndoAction->show()
  #14 /srv/mediawiki/php-1.35.0-wmf.3/includes/MediaWiki.php(304): MediaWiki->performAction(ImagePage, Title)
  #15 /srv/mediawiki/php-1.35.0-wmf.3/includes/MediaWiki.php(967): MediaWiki->performRequest()
  #16 /srv/mediawiki/php-1.35.0-wmf.3/includes/MediaWiki.php(530): MediaWiki->main()
  #17 /srv/mediawiki/php-1.35.0-wmf.3/index.php(44): MediaWiki->run()
  #18 /srv/mediawiki/w/index.php(3): require(string)
  #19 {main}

Details

Related Gerrit Patches:

Event Timeline

Jdx created this task.Oct 23 2019, 7:56 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 23 2019, 7:56 PM
Aklapper renamed this task from Internal error while undoing file captions to Internal error while undoing file captions: "Unsaved revision passed".Oct 24 2019, 4:58 PM
Jdx triaged this task as High priority.Oct 26 2019, 8:32 AM
Jdx added a comment.Oct 26 2019, 8:43 AM

I would like to add that this is pretty annoying issue because it makes reverting multiple vandalisms hard, e.g. I am not able to restore using popups version of File:UA Flight 175 hits WTC south tower 9-11 edit.jpeg from 21st May.

Jdx raised the priority of this task from High to Needs Triage.Oct 26 2019, 10:45 AM
Jdx added a comment.Oct 26 2019, 10:49 AM

@Aklapper No, I don't. Unfortunately, I do not know MW's internals. Just wanted to signal that this is important problem.

Ramsey-WMF triaged this task as High priority.
Ramsey-WMF added a subscriber: Ramsey-WMF.

Can be reproduced

+1. It must be some kind of incompatibility with undo. I tried safemode as well, doesn't work with undo. I also tried using a script which uses undo to restore the page to a specific revision, doesn't work.

Change 548221 had a related patch set uploaded (by Matthias Mullie; owner: Matthias Mullie):
[mediawiki/core@master] Don't calculate amount of inbetween revisions for MCR undo

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

Change 548221 merged by jenkins-bot:
[mediawiki/core@master] Don't calculate amount of inbetween revisions for MCR undo

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

Change 549624 had a related patch set uploaded (by Krinkle; owner: Matthias Mullie):
[mediawiki/core@wmf/1.35.0-wmf.5] Don't calculate amount of inbetween revisions for MCR undo

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

Just so you know, rollback works despite all of this. In other words it is possible to revert changes to Structured Data fields using rollback.

Jdx added a comment.Wed, Nov 27, 10:18 AM

When the changes will be deployed? Three weeks have passed since the day the patch was submitted and lack of fully functional "undo" is a big pain in the butt for people who fight vandalism on Commons…

Masumrezarock100 added a comment.EditedWed, Nov 27, 1:10 PM

When the changes will be deployed? Three weeks have passed since the day the patch was submitted and lack of fully functional "undo" is a big pain in the butt for people who fight vandalism on Commons…

We need a reviewer with +2 access who can merge the change. But for now, use rollback (only applies to latest revisions obviously).

This patch has been approved and merged (you can test it on Test Commons now), but it won't reach real Commons until next Wednesday, due to a split rollout because of the holiday (US Thanksgiving).

When the changes will be deployed? Three weeks have passed since the day the patch was submitted and lack of fully functional "undo" is a big pain in the butt for people who fight vandalism on Commons…

This patch has been approved and merged (you can test it on Test Commons now), but it won't reach real Commons until next Wednesday […]

For significant regressions like these we have a backporting process that allows individual changes to be applied quicker. I've prepared a cherry-pick for this commit:

Change 549624 had a related patch set uploaded (owner: Matthias Mullie):
[mediawiki/core@wmf/1.35.0-wmf.5] Don't calculate amount of inbetween revisions for MCR undo
https://gerrit.wikimedia.org/r/549624

It needs a quick look-over from Matthias, Daniel or someone else familiar with the code to confirm that it applies cleanly to last week's state, and then someone can roll it out tomorrow. I can help with that.

Thanks! I'll defer to @matthiasmullie on that.

Change 549624 merged by jenkins-bot:
[mediawiki/core@wmf/1.35.0-wmf.5] Don't calculate amount of inbetween revisions for MCR undo

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

Mentioned in SAL (#wikimedia-operations) [2019-12-03T01:20:57Z] <jforrester@deploy1001> Synchronized php-1.35.0-wmf.5/includes/diff/DifferenceEngine.php: T236320 Don't calculate amount of inbetween revisions for MCR undo (duration: 00m 59s)

Whoops. I hadn't realized this was blocked on me! Thanks for the ping, @Krinkle & @Ramsey-WMF.

Krinkle renamed this task from Internal error while undoing file captions: "Unsaved revision passed" to Internal error while undoing file captions: "InvalidArgumentException: Unsaved revision passed".Wed, Dec 4, 12:38 AM
Krinkle added a subscriber: Astinson.