Topic on Talk:Parsoid

Summary by Arlolra

Caused by Apache sending an early eof.

194.59.120.161 (talkcontribs)

Hello everyone, in our Wiki installation we are faced with the following error appearing in parsoid.log (on client side/VisualEditor we get a http 500 several time):

{"name":"../src/lib/index.js","hostname":"abcWiki","pid":2956,"level":60,"logType":"fatal/request","wiki":"wiki$0","title":"abcTitle","oldId":null,"reqId":null,"userAgent":"VisualEditor-MediaWiki/1.28.0","msg":"Failed to parse the JSON response for Template Fetch","stack":"Error\n    at TemplateRequest.ApiRequest._handleBody (/usr/lib/parsoid/src/lib/mw/ApiRequest.js:469:12)\n    at TemplateRequest.ApiRequest._requestCB (/usr/lib/parsoid/src/lib/mw/ApiRequest.js:420:8)\n    at Request.self.callback (/usr/lib/parsoid/node_modules/request/request.js:186:22)\n    at emitTwo (events.js:125:13)\n    at Request.emit (events.js:213:7)\n    at Request.<anonymous> (/usr/lib/parsoid/node_modules/request/request.js:1081:10)\n    at emitOne (events.js:115:13)\n    at Request.emit (events.js:210:7)\n    at IncomingMessage.<anonymous> (/usr/lib/parsoid/node_modules/request/request.js:1001:12)\n    at Object.onceWrapper (events.js:312:19)\n    at emitNone (events.js:110:20)\n    at IncomingMessage.emit (events.js:207:7)\n    at endReadableNT (_stream_readable.js:1045:12)\n    at _combinedTickCallback (internal/process/next_tick.js:102:11)\n    at process._tickCallback (internal/process/next_tick.js:161:9)","httpStatus":500,"longMsg":"Failed to parse the JSON response for Template Fetch","levelPath":"fatal/request","time":"2017-06-01T12:12:26.507Z","v":0}

This error occurs when certain pages are edited. We were not able to isolate the problem since the occurance seems to have a random and status dependency. However, we have pages with a relatively complex structure which do not have this problem, and we have pages with a table containing URLs which always causes this error. Does someone has an idea how we get more detail from Parsoid which template this problem causes? Or is there something else we overlooked? Thank you in advance for your help.

SSastry (WMF) (talkcontribs)

Is your wiki public? If yes, can you paste a URL for pages on which you have this problem?

Aschroet (talkcontribs)

Unfortunately the wiki is not public. Could you describe how to further debug the problem that Parsoid has?

SSastry (WMF) (talkcontribs)

Why don't you show up on IRC (#mediawiki-parsoid) one of these days? It will be quicker to figure this out. Do note that we may not respond right away on IRC as well, but it will be a faster turnaround than here. You can then post a resolution of the problem here for everyone's benefit.

Aschroet (talkcontribs)

Seems that nobody is answering in IRC.

Meanwhile, we found out that the this API call

http://host_name/mediawiki/api.php?action=visualeditor&format=json&paction=parse&page=page_name

returns the 500:

{"error":{"code":"500","info":"docserver-http: HTTP 500","*":"See http://host_name/mediawiki/api.php for API usage"}}

Since this call is done multiple times when entering VE we get multiple dialogs with a "500".

Arlolra (talkcontribs)

We discussed on IRC, and this seemed to be caused by Apache sending an early eof, or chunking the response. Whatever the case, the JSON blob that Parsoid was receiving from MediaWiki was truncated. The user was going to investigate further.

Aschroet (talkcontribs)

The problem occurs when Parsoid tries to get the Wikitext from Mediawiki by an URL like this:

http://mediawikiserver/mediawiki/api.php?format=json&action=query&prop=info|revisions&rawcontinue=1&rvprop=content|ids|timestamp|size|sha1|contentmodel&titles=pagename

From time to time the response is truncated because of a "Connection closed by foreign host." which is definitely a network problem on our side.

However, two things i want to mention. First, cURL and browsers can deal with this problem. Maybe it is connected with the HTTP header "Connection: keep-alive" which is not supported by Parsoid. Second, i wonder why Mediawiki is not shipping the Wikitext with the request to Parsoid. Instead, Parsoid additionally calls the Wiki-API which requires that the Parsoid "server" needs the exact endpoints of the Mediawiki "clients".