Page MenuHomePhabricator

LuaStandalone leaks memory for functions returned to PHP
Closed, ResolvedPublic

Description

The LuaStandalone engine holds an id=>function mapping for all the functions it returns to PHP, as happens for example every time a module is invoked. The functions in this mapping are never removed, even after PHP releases all references to the functions on its end. So if a module defines a lot of functions and is invoked many times in a page, it can easily run out the memory limit and cause the interpreter to exit.

LuaSandbox doesn't have this problem, as it does properly unreference the Lua functions when the PHP object is destroyed.


Version: master
Severity: normal

Details

Reference
bz51886

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 2:03 AM
bzimport added a project: Scribunto.
bzimport set Reference to bz51886.
bzimport added a subscriber: Unknown Object (MLST).

Change 93073 had a related patch set uploaded by Anomie:
LuaStandalone: Release functions when no longer referenced

https://gerrit.wikimedia.org/r/93073

Change 93073 merged by jenkins-bot:
LuaStandalone: Release functions when no longer referenced

https://gerrit.wikimedia.org/r/93073