Page MenuHomePhabricator

Page on eowp exceeds memory limit for Lua/Scribunto, does not happen on mobile app
Closed, ResolvedPublic

Description

Pages that use Wikidata intensively give a "not enough memory" error on the website, but not on the official Wikipedia app for Android.

Steps to reproduce:

  1. Go to the webpage https://eo.wikipedia.org/wiki/Uzanto:Robin_van_der_Vliet/provejo with a computer.
  2. Notice Lua errors and notice that some flags are not being rendered.
  3. Go to the the article "Uzanto:Robin_van_der_Vliet/provejo" on the Esperanto Wikipedia with the official Wikipedia app for Android.
  4. Notice that the page renders without any issues.

web.png (497×540 px, 10 KB)
(screenshot of the webpage)

android.png (512×288 px, 15 KB)
(screenshot of the Android app)

Event Timeline

I think the Android app uses the Parsoid rendering of the page, which seems to be not affected by the problem: https://eo.wikipedia.org/api/rest_v1/page/html/Uzanto%3ARobin_van_der_Vliet%2Fprovejo

@Robin0van0der0vliet That page is indeed exceeding the memory limit for Lua/Scribunto, which is set to 50 MB. You can find the following debugging information in the HTML page source: (https://www.mediawiki.org/wiki/NewPP_parser_report)

<!-- 
NewPP limit report
Parsed by mw2182
Cached time: 20180927202137
Cache expiry: 1900800
Dynamic content: false
CPU time usage: 2.292 seconds
Real time usage: 2.388 seconds
Preprocessor visited node count: 21910/1000000
Preprocessor generated node count: 0/1500000
Post‐expand include size: 10883/2097152 bytes
Template argument size: 231/2097152 bytes
Highest expansion depth: 7/40
Expensive parser function count: 10/500
Unstrip recursion depth: 0/20
Unstrip post‐expand size: 0/5000000 bytes
Number of Wikibase entities loaded: 10/400
Lua time usage: 2.221/10.000 seconds
Lua memory usage: 50 MB/50 MB
-->
<!--
Transclusion expansion time report (%,ms,calls,template)
100.00% 2328.431      1 -total
 99.80% 2323.823     50 Ŝablono:Flago
-->

At a glance, it looks like for each flag, you're loading everything from Wikidata entities about the countries, rather than just their flag, and it quickly adds up to 50 MB. I don't know enough about Lua coding to tell you how to fix the problem, but hopefully that helps?

(I don't think this is a MediaWiki bug, rather it's a problem with your template exceeding the limits :( )

At a glance, it looks like for each flag, you're loading everything from Wikidata entities about the countries, rather than just their flag, and it quickly adds up to 50 MB. I don't know enough about Lua coding to tell you how to fix the problem, but hopefully that helps?

I don't think it's possible to only load one single property of a Wikidata entity.

(I don't think this is a MediaWiki bug, rather it's a problem with your template exceeding the limits :( )

I think the fact that pages are differently rendered on the website and in the Android app can be considered a bug. People probably expect pages to be rendered more or less the same.

Maybe we could make the memory limit for both rendering engines the same?

In T205646#4623533, @Robin0van0der0vliet wrote:

At a glance, it looks like for each flag, you're loading everything from Wikidata entities about the countries, rather than just their flag, and it quickly adds up to 50 MB. I don't know enough about Lua coding to tell you how to fix the problem, but hopefully that helps?

I don't think it's possible to only load one single property of a Wikidata entity.

Huh, indeed. Seems to be a long-standing feature request – I found T198116: Do not load the entire item into the Lua memory without the need, which seems to report almost the same issue as yours, and that references some older tasks.

Anomie subscribed.

I think the Android app uses the Parsoid rendering of the page, which seems to be not affected by the problem: https://eo.wikipedia.org/api/rest_v1/page/html/Uzanto%3ARobin_van_der_Vliet%2Fprovejo

Probably it's evaluating each {{#invoke}} individually rather than parsing them all in the context of one parse.

Aklapper renamed this task from Not enough memory error on the website, but not on mobile app. to Page on eowp exceeds memory limit for Lua/Scribunto, does not happen on mobile app.Jan 3 2019, 11:29 PM
Pppery subscribed.

Can't reproduce - I visited the page with my computer and it gets no errors. Probably fixed by T349462