Last modified: 2014-08-28 21:49:19 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T72006, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 70006 - LuaSandbox reports substantially higher memory utilization under HHVM
LuaSandbox reports substantially higher memory utilization under HHVM
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Scribunto (Other open bugs)
master
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
: hhvm
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-08-25 22:31 UTC by Ori Livneh
Modified: 2014-08-28 21:49 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
pprof trace of allocations during life-cycle of lua state (180.38 KB, text/plain)
2014-08-27 19:11 UTC, Ori Livneh
Details

Description Ori Livneh 2014-08-25 22:31:02 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%
    -->
Comment 1 Ori Livneh 2014-08-27 19:11:14 UTC
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.
Comment 2 Gerrit Notification Bot 2014-08-28 07:41:31 UTC
Change 156758 had a related patch set uploaded by Ori.livneh:
Fix LuaSandboxFunction leak

https://gerrit.wikimedia.org/r/156758
Comment 3 Gerrit Notification Bot 2014-08-28 21:01:01 UTC
Change 156758 merged by jenkins-bot:
Fix LuaSandboxFunction leak

https://gerrit.wikimedia.org/r/156758
Comment 4 Ori Livneh 2014-08-28 21:49:19 UTC
Merged, repacked, deployed, and verified.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links