Topic on Extension talk:VisualEditor

Intermitant problems with pages containing large number of images from shared repository

1
Summary by Arlolra

Being discussed in Topic:Taq87rii0fuvswgd

T0lk (talkcontribs)

I recently installed Parsoid and VisualEditor. All parsoid tests done independent of VE function correctly. Pages with no images, or pages that contain only 1-4 images from a shared repository all work fine. Parsoid reports something like "started parsing" and then "completed parsing in 9998 ms". However, if the page contains a large number of images from a shared repository then a number of errors are reported.

First, a series of Failed API requests, {"error":{"code": "ETIMEDOUT"},"retries-remaining":1}

When loading the same page over and over (with 5 images which seems to be on the border between working and not working) the api failure may happen no times or up to 9 times depending on server load. With no failure, templates and images both load correctly. For every api failure either the template or image will fail to load, leaving that little puzzle piece icon where the template should be. As a note, a template is calling the images like this: {{page|1|file=Centenary.pdf|page=22}} where the pdf file resides on a different domain, but with shared media settings.

After the API failures I will also see 8 or so Error: Template Expansion failure for "97bc6349e16b5680ae9006d5c0b88d0b": Error: ETIMEDOUT

Template Expansion failure for "97bc6349e16b5680ae9006d5c0b88d0b": Error: ETIMEDOUT

Error: Template Expansion failure for "97bc6349e16b5680ae9006d5c0b88d0b": Error: ETIMEDOUT

at PreprocessorRequest.ApiRequest._requestCB (/usr/lib/parsoid/src/lib/mw/ApiRequest.js:407:15)

at self.callback (/usr/lib/parsoid/node_modules/request/request.js:198:22)

at Request.EventEmitter.emit (events.js:95:17)

at Request.onRequestError (/usr/lib/parsoid/node_modules/request/request.js:867:8)

at ClientRequest.EventEmitter.emit (events.js:95:17)

at CleartextStream.socketErrorListener (http.js:1547:9)

at CleartextStream.EventEmitter.emit (events.js:95:17)

at null._onTimeout (/usr/lib/parsoid/src/lib/mw/ApiRequest.js:45:8)

at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

Any pointers would be helpful. My server is running on nginx, forcing connections over https. In settings.js

parsoidConfig.setMwApi({ prefix: 'mydomain', uri: 'https://mydomain.com/api.php', domain: 'mydomain.com' });

If I exclude the S above in https, I do not get the failed api errors, but then templates and images do not load, and I get the Template Expansion Failure errors instead, and a curl http://...api.php yields 301 moved permanently.

In Localsettings.php I have

$wgVirtualRestConfig['modules']['parsoid'] = array(

'url' => 'http://localhost:8142',

'domain' => 'mydomain.com',

'prefix' => 'mydomain'

);

I have not done any of the "Parsoid over HTTPS" steps, I was not sure if they were necessary. My thought is a timeout problem in the communication between parsoid and visualeditor, but I can't be certain. I do have $wgSessionsInObjectCache = true but I'm running Mediawiki 1.27.0 and Manual:$wgSessionsInObjectCache implies that is redundant.

UPDATE: I've made some progress towards a solution. In /usr/lib/parsoid/src/lib/mw/ApiRequest.js there is a line var HTTP_CONNECT_TIMEOUT = 5 * 1000;  // 5 seconds which seems to be directly related to my problem. Changing it from 5 seconds to 10 seconds allows me to process pages with up to 10 images. It seems like it's taking 1 second per image, so I tried 40 seconds and a page with 27 images. The log file noted completed parsing in 32439 ms but the browser reported error loading data from server HTTP 0. Would you like to retry? and fails. Note: Error in Firefox, but not Chrome.