Last modified: 2014-08-28 21:49:19 UTC
Previewing a no-diff edit to the Barack Obama article on enwiki utilizes vastly more memory under HHVM than it does with PHP (50.21 MB vs. 5.33 MB). On HHVM, it is enough to exhaust the memory limit and cause script errors to occur. A memory leak seems likely. Below are NewPP limit reports for HHVM and PHP: HHVM: <!-- NewPP limit report Parsed by mw1017 CPU time usage: 6.575 seconds Real time usage: 5.359 seconds Preprocessor visited node count: 36328/1000000 Preprocessor generated node count: 134482/1500000 Post‐expand include size: 667573/2048000 bytes Template argument size: 33250/2048000 bytes Highest expansion depth: 23/40 Expensive parser function count: 13/500 Lua time usage: 1.600/10.000 seconds Lua memory usage: 50.21 MB/50 MB --> PHP: <!-- NewPP limit report Parsed by mw1021 CPU time usage: 15.661 seconds Real time usage: 16.292 seconds Preprocessor visited node count: 44800/1000000 Preprocessor generated node count: 146396/1500000 Post‐expand include size: 1567883/2048000 bytes Template argument size: 215760/2048000 bytes Highest expansion depth: 23/40 Expensive parser function count: 39/500 Lua time usage: 2.165/10.000 seconds Lua memory usage: 5.33 MB/50 MB Lua Profile: Scribunto_LuaSandboxCallback::getExpandedArgument 1320 ms 36.3% recursiveClone <mwInit.lua:11> 380 ms 10.4% dataWrapper <mw.lua:665> 340 ms 9.3% Scribunto_LuaSandboxCallback::getAllExpandedArguments 240 ms 6.6% Scribunto_LuaSandboxCallback::getEntity 160 ms 4.4% mw.executeModule <mw.lua:465> 140 ms 3.8% ? 120 ms 3.3% selectone <Module:Citation/CS1:1026> 100 ms 2.7% <Module:Citation/CS1:102> 100 ms 2.7% (for generator) 80 ms 2.2% [others] 660 ms 18.1% -->
Created attachment 16295 [details] pprof trace of allocations during life-cycle of lua state I'm trying to debug by linking HHVM and LuaSandbox against tcmalloc, hacking LuaSandbox not to use a custom allocator, and inserting HeapProfilerStart / HeapProfilerDump before luaL_newstate and after lua_close, respectively. The PHP code I'm running involves some hacks to core and wmf-config, so it's not easy to reproduce here, but the gist of it is that it parses the Barack Obama article. I'm not yet adept at reading the output of pprof, but I'm including it as an attachment in case it's useful for Tim or Brad (or someone else). FWIW, the various traces I've generated while getting acquainted with the tooling for debugging leaks do mention XML-related functions suspiciously often.
Change 156758 had a related patch set uploaded by Ori.livneh: Fix LuaSandboxFunction leak https://gerrit.wikimedia.org/r/156758
Change 156758 merged by jenkins-bot: Fix LuaSandboxFunction leak https://gerrit.wikimedia.org/r/156758
Merged, repacked, deployed, and verified.