Page MenuHomePhabricator

Wikidata page shows "Lua error: not enough memory"
Closed, DeclinedPublic

Description

This page: https://www.wikidata.org/wiki/Wikidata:Menu_Challenge/participants#User:OrenBochman
shows Lua out of memory errors in the section starting with the anchor part of the URL above.

Event Timeline

Ijon created this task.May 14 2015, 7:38 PM
Ijon raised the priority of this task from to Needs Triage.
Ijon updated the task description. (Show Details)
Ijon added a subscriber: Ijon.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMay 14 2015, 7:38 PM
aude added a subscriber: aude.EditedMay 14 2015, 10:17 PM

I took a look at the lua module that is ultimately used here.

https://www.wikidata.org/wiki/Module:Wikidata

It uses mw.wikibase.getEntityObject to load the entire entity and then get just the label, afaik in just the content language of Wikidata. In this case, we are also dealing with access to arbitrary items, which is expensive. That means there is a limit on the number of entities we can load per page.

It would be better if the module used the mw.wikibase.label convenience when possible. It uses a term lookup (wb_terms table) to get individual labels without loading the entire entity, so is less expensive and can be done more times on a page.

in https://www.wikidata.org/wiki/User:Aude/menu_challenge2, using a copy of the module, https://www.wikidata.org/wiki/Module:Wikidata_test, I tried the following code and (although somewhat ugly) it seems to work better including in other languages than English.

function p._getLabel(entity, lang, default)
	local label
 
	if lang == defaultlang then
		label = mw.wikibase.label(entity)
 
		if not label then
			return defaultlabel(entity, lang, default)
		end
 
		return label
	end
 
	if not entity then
		return nil
	end
	if type(entity) ~= 'table' then
		entity = p.getEntity(entity)
	end
	if (not entity) or (not entity.labels) then
		return entity--defaultlabel(entity, lang, default)
	end
	for i, lg in pairs(fb.fblist(lang or defaultlang)) do
		if entity.labels[lg] then
			return entity.labels[lg].value
		end
	end
	return defaultlabel(entity, lang, default)
end

if mw.wikibase.label() also took a 'lang' param, then perhaps it could always and be the only thing used in p._getLabel

aude set Security to None.May 14 2015, 10:20 PM
aude added a subscriber: hoo.
Lydia_Pintscher closed this task as Declined.May 15 2015, 1:13 PM
Lydia_Pintscher claimed this task.
Lydia_Pintscher added a subscriber: Lydia_Pintscher.

Thanks for the report. This needs to be fixed on-wiki in the Lua module.

Restricted Application added a subscriber: StudiesWorld. · View Herald TranscriptDec 4 2015, 3:20 AM