Page MenuHomePhabricator

Tablesorter hangs browsers on page load
Closed, ResolvedPublic

Description

The page http://fi.wikipedia.org/wiki/Suomen_hallitus hangs in Chrome and Firefox soon after opening.

Firefox gives the following culprit as unresponsive script when debug=true: http://bits.wikimedia.org/static-1.21wmf3/resources/jquery/jquery.tablesorter.js:920


Version: 1.21.x
Severity: critical
URL: http://fi.wikipedia.org/w/index.php?title=Suomen_valtioneuvosto&oldid=12132931

Details

Reference
bz42097

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 1:04 AM
bzimport set Reference to bz42097.
bzimport added a subscriber: Unknown Object (MLST).

Switched URL to permanent link: I've made the table non-sortable because it crashed my browsers.

Confirming with Firefox 16.0.2; wondering how many pages are affected by this.

Also hangs Epiphany 3.4 (WebKit based) and Konqueror (KHTML) 4.8.5.
Opera 12.02 works fine here.

Same happens on my Opera 12.10 on the linked page on fi.wiki.

By stepping through the code with the debugger, I was able to pinpoint the hang to the following place (currently being lines 610 and 611 in git master):

// initially build the cache for the tbody cells (to be able to sort initially)
cache = buildCache( table );

The buildCache() function contains a pretty straightforward for loop, so it might be something bigger.

The gerrit change https://gerrit.wikimedia.org/r/#/c/32593/ might help alleviate the issue: at the very least it defers the buildCache() call to after the user attempts to sort the table (and not on the page load), and just might magically fix the issue (but I didn't test it).

So I identified the root cause.

The 'date' parser assumed all wikis use wgDefaultDateFormat that is either 'mdy' or 'dmy', but this is not the case; for example fi.wikipedia uses 'fi normal'. Therefore the correct value was not set, a string was not changed to an array, and a loop that assumed an array would be present hanged forever.

Submitted a stopgap fix as gerrit change 33417; it would be nice to get it merged and deployed quickly.

Pxos.Fiwiki wrote:

(In reply to comment #6)

Patch merged.

The problem remains the same.

(In reply to comment #8)

(In reply to comment #6)

Patch merged.

The problem remains the same.

Yes Pxos, as Nikerabbit said someone should also deploy it, otherwise it will go live presumably with 1.21wmf5 on Wednesday, December 5 for fi.wiki... https://www.mediawiki.org/wiki/MediaWiki_1.21/Roadmap

Pxos.Fiwiki wrote:

There is another problem with this new sortable as well. It used to understand the special separate rows inside the tables but now it doesn't.

Formerly http://fi.wikipedia.org/w/index.php?title=Luettelo_rikoksista_tuomituista_kansanedustajista&oldid=12344892 this page had the correct layout even when it was sortable. Now the rows are not displayed properly when the table is sorted.

(In reply to comment #10)

There is another problem with this new sortable as well.

Please file new bugs as new bugs, instead of attaching a comment to old, closed bugs. Thanks.

Roan just backported and deployed, so this should be fixed in production.