Page MenuHomePhabricator

JavaScript freeze/loop when editing or adding references
Closed, DuplicatePublic1 Estimated Story Points

Description

In both these cases, one JavaScript cannot stop, the browser freezes and after some time Firefox displays a popup about a not responding JavaScript. When not clicking on "Stop", the saving animation (for case 2) continuous to run indefinitely.

  • case 1: Click on the "Reference" button. Freeze…
  • case 2: Edit a reference and click on "Save changes"

tested with Firefox 55 and 57, German wiki. (tested with: https://de.wikipedia.org/wiki/Threema)

Event Timeline

Deskana triaged this task as Unbreak Now! priority.Sep 18 2017, 10:17 AM
Deskana subscribed.

This seems to be a performance problem somehow related to large articles on the German Wikipedia. I tried to reproduce with some large articles, and some random articles; all the large articles had this problem, and all the random articles (which tend to be smaller) did not.

I also tested in some large articles on the English Wikipedia, and could not reproduce this problem, although the reference box did seem a little bit slower than it should, so it seems like this is a more general performance problem that is affecting the German Wikipedia in a particularly disastrous fashion.

Large articles:

  1. https://de.wikipedia.org/wiki/Vereinigte_Staaten
  2. https://de.wikipedia.org/wiki/Deutchland
  3. https://de.wikipedia.org/wiki/Angela_Merkel
  4. https://de.wikipedia.org/wiki/Europ%C3%A4ische_Union

Random articles:

  1. https://de.wikipedia.org/wiki/Distichodontidae
  2. https://de.wikipedia.org/wiki/Woodson_Terrace_(Missouri)
  3. https://de.wikipedia.org/wiki/Standesvertretung
  4. https://de.wikipedia.org/wiki/Dietrich_Ottmar_von_Erwitte
  5. https://de.wikipedia.org/wiki/Durris_Castle

The problem is they have started using the <references> tag again, which is a good thing because it means the ref list updates dynamically. Unfortunately the large wikis have been using {{references}} templates for so long that we haven't noticed the performance issues.

Change 378690 had a related patch set uploaded (by Esanders; owner: Esanders):
[mediawiki/extensions/Cite@master] Debounce reference list updates

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

The above patch fixes the symptom if not the cause.

Pseudo-tested on de.wiki by pasting the following monkey patch in the console:

ve.ce.MWReferencesListNode.prototype._update = ve.ce.MWReferencesListNode.prototype.update;
ve.ce.MWReferencesListNode.prototype.update = ve.debounce( ve.ce.MWReferencesListNode.prototype._update );

Change 378690 merged by jenkins-bot:
[mediawiki/extensions/Cite@master] Debounce reference list updates

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

I think TreeModifier could be to blame, emitting more events than we used to and causing the list to rebuild many more times. Pinging @dchan .

Patch for this open Unbreak now! priority task has been merged two weeks ago.
What is left to do here?

Deskana lowered the priority of this task from Unbreak Now! to Medium.Oct 5 2017, 9:24 AM

The freezing problem is solved, but there's still other work to be done.

Deskana set the point value for this task to 1.Oct 12 2017, 1:26 PM

There's no patch to review here any more, but as I noted above, there's still other work to be done.

What remains here is essentially the same as T134975, so I'm going to merge them together.