Ticket #799 (closed maintenance: fixed)

Opened 2 years ago

Last modified 21 months ago

MediaWiki Visual Editor broken from Parsoid update

Reported by: chris Owned by: chris
Priority: major Milestone: Maintenance
Component: Mediawiki Keywords:
Cc: ade Estimated Number of Hours: 0.0
Add Hours to Ticket: 0 Billable?: yes
Total Hours: 2.66

Description

After updating Parasoid on ticket:692#comment:102 the MediaWiki visual editor now generates this error:

Error loading data from server: parsoidserver-http-bad-status: 500. Would you like to retry?

Change History

comment:1 Changed 2 years ago by chris

  • Add Hours to Ticket changed from 0.0 to 0.5
  • Total Hours changed from 0.0 to 0.5

There is this bug regarding the error message:

And lots of other people issues like this:

In the /var/log/parsoid/parsoid.log we have lots of errors like this:

[info][localhost/Sandbox?oldid=933] started parsing
[fatal/request][localhost/Sandbox?oldid=933] undefined is not a function
TypeError: undefined is not a function
    at TreeBuilder.resetState (/usr/lib/parsoid/src/lib/mediawiki.HTML5TreeBuilder.node.js:61:17)
    at new TreeBuilder (/usr/lib/parsoid/src/lib/mediawiki.HTML5TreeBuilder.node.js:28:7)
    at ParserPipelineFactory.makePipeline (/usr/lib/parsoid/src/lib/mediawiki.parser.js:231:17)
    at ParserPipelineFactory.makePipeline (/usr/lib/parsoid/src/lib/mediawiki.parser.js:227:17)
    at ParserPipelineFactory.getPipeline (/usr/lib/parsoid/src/lib/mediawiki.parser.js:363:15)
    at ParserPipelineFactory.parse (/usr/lib/parsoid/src/lib/mediawiki.parser.js:311:20)
    at /usr/lib/parsoid/node_modules/prfun/lib/index.js:436:24
    at new Promise (/usr/lib/parsoid/src/node_modules/es6-shim/es6-shim.js:1228:11)
    at /usr/lib/parsoid/node_modules/prfun/lib/index.js:419:14
    at /usr/lib/parsoid/src/api/routes.js:152:62

However creating a new page worked fine:

But when trying to edit it:

Error loading data from server: parsoidserver-http-bad-status: 500. Would you like to retry?

And this in /var/log/parsoid/parsoid.log:

[info][localhost/Sandbox2?oldid=946] started parsing
[fatal/request][localhost/Sandbox2?oldid=946] undefined is not a function
TypeError: undefined is not a function
    at TreeBuilder.resetState (/usr/lib/parsoid/src/lib/mediawiki.HTML5TreeBuilder.node.js:61:17)
    at new TreeBuilder (/usr/lib/parsoid/src/lib/mediawiki.HTML5TreeBuilder.node.js:28:7)
    at ParserPipelineFactory.makePipeline (/usr/lib/parsoid/src/lib/mediawiki.parser.js:231:17)
    at ParserPipelineFactory.makePipeline (/usr/lib/parsoid/src/lib/mediawiki.parser.js:227:17)
    at ParserPipelineFactory.getPipeline (/usr/lib/parsoid/src/lib/mediawiki.parser.js:363:15)
    at ParserPipelineFactory.parse (/usr/lib/parsoid/src/lib/mediawiki.parser.js:311:20)
    at /usr/lib/parsoid/node_modules/prfun/lib/index.js:436:24
    at new Promise (/usr/lib/parsoid/src/node_modules/es6-shim/es6-shim.js:1228:11)
    at /usr/lib/parsoid/node_modules/prfun/lib/index.js:419:14
    at /usr/lib/parsoid/src/api/routes.js:152:62

In irc://irc.freenode.org/#mediawiki-pars restarting Parsoid was suggested, this is something I had already tried:

/etc/init.d/parsoid stop
/etc/init.d/parsoid start
Started Parsoid server on port 8142
Last edited 2 years ago by chris (previous) (diff)

comment:2 Changed 2 years ago by chris

I think I'll raise this on the Mediawiki bugzilla, this is the version that is installed:

dpkg -l parsoid 
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                 Version         Architecture    Description
+++-====================-===============-===============-==============================================
ii  parsoid              0.1.15          amd64           Web service converting HTML+RDFa to MediaWiki 

comment:3 Changed 2 years ago by chris

  • Add Hours to Ticket changed from 0.0 to 0.11
  • Total Hours changed from 0.5 to 0.61

In /web/wiki.transitionnetwork.org/www/LocalSettings.php there are these settings:

$wgDefaultUserOptions['visualeditor-enable'] = 1;

$wgVisualEditorParsoidURL = 'http://localhost:8142';

require_once("$IP/extensions/VisualEditor/VisualEditor.php");

require_once("$IP/extensions/Parsoid/Parsoid.php");

This is the version of nodejs:

dpkg -l nodejs
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                 Version         Architecture    Description
+++-====================-===============-===============-==============================================
ii  nodejs               0.10.29~dfsg-1~ amd64           evented I/O for V8 javascript

The bug can also be triggered like this:

lynx http://localhost:8142/localhost/Main_Page

[fatal/request][localhost/Main_Page?oldid=811] undefined is not a function
TypeError: undefined is not a function
    at TreeBuilder.resetState (/usr/lib/parsoid/src/lib/mediawiki.HTML5TreeBuilder.node.js:61:17)
    at new TreeBuilder (/usr/lib/parsoid/src/lib/mediawiki.HTML5TreeBuilder.node.js:28:7)
    at ParserPipelineFactory.makePipeline (/usr/lib/parsoid/src/lib/mediawiki.parser.js:231:17)
    at ParserPipelineFactory.makePipeline (/usr/lib/parsoid/src/lib/mediawiki.parser.js:227:17)
    at ParserPipelineFactory.getPipeline (/usr/lib/parsoid/src/lib/mediawiki.parser.js:363:15)
    at ParserPipelineFactory.parse (/usr/lib/parsoid/src/lib/mediawiki.parser.js:311:20)
    at /usr/lib/parsoid/node_modules/prfun/lib/index.js:436:24
    at new Promise (/usr/lib/parsoid/src/node_modules/es6-shim/es6-shim.js:1228:11)
    at /usr/lib/parsoid/node_modules/prfun/lib/index.js:419:14
    at /usr/lib/parsoid/src/api/routes.js:152:62

The above URL is a 302:

lynx -head -dump http://localhost:8142/localhost/Main_Page

HTTP/1.1 302 Moved Temporarily
X-Powered-By: Express
Vary: Accept-Encoding
Access-Control-Allow-Origin: *
Cache-Control: private,no-cache,s-maxage=0
Location: /localhost/Main_Page?oldid=811
Date: Tue, 21 Oct 2014 11:27:03 GMT
Connection: close

And the URL redirected to is a 500 error:

lynx -head -dump http://localhost:8142/localhost/Main_Page?oldid=811

HTTP/1.1 500 Internal Server Error
X-Powered-By: Express
Vary: Accept-Encoding
Access-Control-Allow-Origin: *
Cache-Control: s-maxage=2592000
content-revision-id: 811
Content-Type: text/plain; charset=UTF-8
Content-Length: 936
Date: Tue, 21 Oct 2014 11:27:57 GMT
Connection: close
Last edited 2 years ago by chris (previous) (diff)

comment:4 Changed 2 years ago by chris

  • Add Hours to Ticket changed from 0.0 to 0.5
  • Total Hours changed from 0.61 to 1.11

This is the content of /etc/apt/sources.list.d/parsoid.list:

deb [arch=amd64] http://parsoid.wmflabs.org:8080/deb wmf-production main

Check which versions we have cached and then install the old version:

ls /var/cache/apt/archives/ | grep parsoid                
parsoid_0.1.12_amd64.deb
parsoid_0.1.15_amd64.deb
apt-get install parsoid=0.1.12

Now editing works OK again.

I have opened a ticket about this issue on Bugzilla, https://bugzilla.wikimedia.org/show_bug.cgi?id=72304 following discussions on irc://irc.freenode.net/#mediawiki-pars

I have also disabled the repo for parsoid to prevent Munin sending alerts every 5 mins regarding new version of parsoid being available, via /etc/apt/sources.list.d/parsoid.list:

#deb [arch=amd64] http://parsoid.wmflabs.org:8080/deb wmf-production main
Last edited 2 years ago by chris (previous) (diff)

comment:5 Changed 2 years ago by chris

I have just checked if there is a new version of parsoid available, there isn't, for future reference this is how I checked:

apt-get -V -s upgrade
  Reading package lists... Done
  Building dependency tree       
  Reading state information... Done
  The following packages will be upgraded:
     parsoid (0.1.12 => 0.1.15)
  1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
  Inst parsoid [0.1.12] (0.1.15 . wmf-production:parsoid.wmflabs.org [amd64])
  Conf parsoid (0.1.15 . wmf-production:parsoid.wmflabs.org [amd64])
dpkg -s parsoid | grep Version
  Version: 0.1.12

See also:

comment:6 Changed 2 years ago by chris

  • Add Hours to Ticket changed from 0.0 to 0.5
  • Total Hours changed from 1.11 to 1.61

Update on the MediaWiki ticket (now migrated from Bugzilla):

We just released v0.2.0 to both npm and the Debian repository. Could you check if this issue is fixed?

So, edited /etc/apt/sources.list.d/parsoid.list to remove comment at the start of the line:

deb [arch=amd64] http://parsoid.wmflabs.org:8080/deb wmf-production main

Ran the AptitudeUpdateScript which upgraded Parsoid, kept the local /etc/mediawiki/parsoid/settings.js file, this was recorded in the /root/Changelog:

2014-12-04      chris
        *       parsoid/wmf-production : updated

Restarted Parsoid:

/etc/init.d/parsoid restart

Tried editing the Sandbox, got this error:

Error loading data from server: parsoidserver-http-bad-status: 500. Would you like to retry?

So reverting to the old version:

apt-get install parsoid=0.1.12

And posted a comment on the new bug tracker, this comment took a while as getting an account sorted on the new bug tracked wasn't so straightforward...

comment:7 Changed 2 years ago by chris

  • Add Hours to Ticket changed from 0.0 to 0.25
  • Total Hours changed from 1.61 to 1.86

comment:8 Changed 2 years ago by chris

  • Add Hours to Ticket changed from 0.0 to 0.4
  • Total Hours changed from 1.86 to 2.26

Question posted on the bugtracker:

Is the error message still the same after a apt-get remove --purge parsoid followed by apt-get install parsoid ?

So I edited /etc/apt/sources.list.d/parsoid.list and uncommented this line:

deb [arch=amd64] http://parsoid.wmflabs.org:8080/deb wmf-production main

And ran:

aptitude update

Then backing up the Parsoid settings, first identify the files installed in /etc:

dpkg -L parsoid | grep ^/etc
/etc
/etc/mediawiki
/etc/mediawiki/parsoid
/etc/mediawiki/parsoid/settings.js
/etc/default
/etc/default/parsoid
/etc/init.d
/etc/init.d/parsoid
/etc/logrotate.d
/etc/logrotate.d/parsoid

Then copy the config file:

cp /etc/mediawiki/parsoid/settings.js /root/

(with hindsight the same should have been done for /etc/default/parsoid)

Then uninstall, purge and reinstall:

aptitude remove parsoid
aptitude purge parsoid

I checked that the /etc/mediawiki/parsoid directory had been removed, then reinstall:

aptitude update
aptitude install parsoid

Diff the old and new config files:

diff /etc/mediawiki/parsoid/settings.js /root/settings.js | vim -

1d0
< "use strict";
20c19,21
<       parsoidConfig.setInterwiki( 'localhost', 'http://localhost/w/api.php' );
---
>       // chris
>       //parsoidConfig.setInterwiki( 'localhost', 'http://localhost/w/api.php' );
>       parsoidConfig.setInterwiki( 'localhost', 'http://wiki.transitionnetwork.org/api.php' );
27a29
>       //parsoidConfig.debug = true;
35a38
>       // chris
36a40
>       parsoidConfig.allowCORS = 'wiki.transitionnetwork.org';

And change these lines:

        parsoidConfig.setInterwiki( 'localhost', 'http://wiki.transitionnetwork.org/api.php' );

        parsoidConfig.allowCORS = 'wiki.transitionnetwork.org';

Restart the server:

/etc/init.d/parsoid restart

And test editing the wiki, and we have the same error message:

Error loading data from server: parsoidserver-http-bad-status: 500. Would you like to retry?

So downgrading again:

apt-get install parsoid=0.1.12

And commented the line in /etc/apt/sources.list.d/parsoid.list to prevent upgrades and posted a comment to the ticket.

comment:9 Changed 23 months ago by ed

this is going on too long for a wiki that isn't being used - and TN moving to google docs means that it's even less likely to be used - so hold off on any work on this for now and let's discuss when we meet.

comment:10 Changed 21 months ago by chris

  • Cc ade added; ed removed
  • Status changed from new to accepted

There is still no answer regarding how to get the latest Parsiod working on Debian Wheezy, hovever I have setup a dedicated Parsiod server on Debian Jessie that we can use, see https://docs.webarch.net/wiki/MediaWiki#VisualEditor so I suggest:

  • Setting up MediaWiki to use the external Parsoid server at parsoid.webarch.net
  • Uninstalling Parsoid from PenguinServer (this should free up some RAM)

comment:11 Changed 21 months ago by chris

  • Add Hours to Ticket changed from 0.0 to 0.4
  • Status changed from accepted to closed
  • Resolution set to fixed
  • Total Hours changed from 2.26 to 2.66

On the Parsoid server I edited /etc/mediawiki/parsoid/settings.js and added:

        parsoidConfig.setInterwiki( 'wiki.transitionnetwork.org', 'http://wiki.transitionnetwork.org/api.php' );

        parsoidConfig.allowCORS = 'wiki.transitionnetwork.org';

And then I edited the firewall rules, /etc/iptables/rules.v4 and added:

# wiki.transitionnetwork.org
-A INPUT -p tcp --dport 8142 -s 81.95.52.111 -j ACCEPT

Then restarted Parsiod and reloaded the firewall:

service parsoid restart
iptables-restore < /etc/iptables/rules.v4 
iptables -L | grep penguin
  ACCEPT     tcp  --  penguin.webarch.net  anywhere             tcp dpt:8142

Then on PenguinServer I edited /web/wiki.transitionnetwork.org/www/LocalSettings.php and changed these lines:

// URL to the Parsoid instance
// MUST NOT end in a slash due to Parsoid bug
//$wgVisualEditorParsoidURL = 'http://localhost:8142';
$wgVisualEditorParsoidURL = 'http://parsoid.webarch.net:8142';

// Interwiki prefix to pass to the Parsoid instance
// Parsoid will be called as $url/$prefix/$pagename
$wgVisualEditorParsoidPrefix = 'wiki.transitionnetwork.org';

This setup was tested via the https://wiki.transitionnetwork.org/Sandbox page and all was working, so uninstalling Parsoid:

aptitude remove parsoid
rm /etc/apt/sources.list.d/parsoid.list 

And the documentation, wiki:MediaWiki#Parsoid was updated, closing this ticket as fixed.

Last edited 21 months ago by chris (previous) (diff)
Note: See TracTickets for help on using tickets.