Page MenuHomePhabricator

[Regression] VisualEditor no long able to rescue itself from badtoken error state on save
Closed, ResolvedPublic1 Story Points

Description

Steps to reproduce:

The the browser starts sending requests to the visualeditoredit API and goes on repeating them forever. An example request (in cURL format) is P342. The response is always a badtoken error. The token does not change between requests.

The interface is unresponsive (none of the buttons work); Esc closes the save window but does not stop the request loop.

Could not reproduce, after reloading the page and redoing the edit it was saved successfully.

A lot of time passed between opening the page and starting to edit in VE, but not a lot of time between starting to edit and saving.

Event Timeline

Tgr created this task.Feb 28 2015, 6:46 AM
Tgr updated the task description. (Show Details)
Tgr raised the priority of this task from to Needs Triage.
Tgr added a project: VisualEditor.
Tgr added a subscriber: Tgr.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptFeb 28 2015, 6:46 AM
Jdforrester-WMF renamed this task from VisualEditor gets into endless visualeditoredit API loop when saving the page to VisualEditor got into endless visualeditoredit API loop when saving the page.
Jdforrester-WMF triaged this task as Normal priority.
Jdforrester-WMF set Security to None.
Catrope added a subscriber: Catrope.Mar 2 2015, 7:45 AM

Could this be a regression from when we moved to mw.Api recently?

Catrope added a subscriber: Krenair.Mar 2 2015, 7:45 AM

Timo and Nik complained about running into this issue too.

I believe I hit this today. I've since closed the tab so my browser is no use, sorry!

VisualEditor definitely does quite a bit of manual token handling instead of using postWithToken (although I don't see obvious mistakes at a glance). Not sure if the internal action=visualeditor API is incompatible with that, or if the code just predates postWithToken.

I'm pretty sure I hit this bug when I made this edit on mediawiki.org on 2015-02-26. Roan and Moriel helped me recover the edit by doing the following:

  1. Run the javascript console
  2. Type copy(ve.init.target.docToSave.documentElement.outerHTML) (Congratulations! You have the parsoid HTML in the clipboard. Save it to a safe text buffer if you're paranoid)
  3. Visit the parsoid HTML to wikitext converter (change the URL for the wiki you're on)
  4. Paste the parsoid HTML and submit
  5. Copy/paste this wikitext in the source editor for the article.

This bug seems pretty high priority. I realize there isn't too much that can be done until there's a reliable repro, but it might be worth more actively working on whatever instrumentation/testing necessary to see this in action.

Aklapper raised the priority of this task from Normal to High.Mar 5 2015, 10:25 AM
matmarex claimed this task.Mar 6 2015, 12:09 AM

Easy to reproduce, at least. Just make the edit token that VE stores invalid (ve.init.target.editToken = 'foo') and try saving the page.

Jdforrester-WMF renamed this task from VisualEditor got into endless visualeditoredit API loop when saving the page to [Regression] VisualEditor no long able to rescue itself from badtoken error state on save.Mar 6 2015, 12:14 AM
Jdforrester-WMF raised the priority of this task from High to Unbreak Now!.
Jdforrester-WMF edited a custom field.
matmarex added a comment.EditedMar 6 2015, 12:24 AM

At a quick glance, we have several different code paths towards saving (thanks to speculative save feature), and none of them implements badtoken handling right (although some try). I'm going to redo it all with postWithToken, it looks easier than trying to understand the twisted logic.

(added: Actually, I'm not.)

Change 194783 had a related patch set uploaded (by Bartosz Dziewoński):
ve.init.mw.Target: Don't go into infinite recursion on API errors

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

Change 194783 merged by jenkins-bot:
ve.init.mw.Target: Don't go into infinite recursion on API errors

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

Change 194869 had a related patch set uploaded (by Jforrester):
ve.init.mw.Target: Don't go into infinite recursion on API errors

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

Change 194870 had a related patch set uploaded (by Jforrester):
ve.init.mw.Target: Don't go into infinite recursion on API errors

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

Change 194869 merged by jenkins-bot:
ve.init.mw.Target: Don't go into infinite recursion on API errors

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

Change 194870 merged by jenkins-bot:
ve.init.mw.Target: Don't go into infinite recursion on API errors

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

Jdforrester-WMF moved this task from External and Administrivia to Q4 on the VisualEditor board.
Jdforrester-WMF closed this task as Resolved.