[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#712387: [libqt4-script] Javascript JIT: excessive executable VIRT usage (>2GB)!



Package: libqt4-script
Version: 4:4.8.4+dfsg-4
Severity: normal

--- Please enter the report below this line. ---

I've noticed that plasma-desktop (and kwin too) is using a LOT of VIRT, i.e. >2GB:
 5254 edwin     20   0 2943320  65652  35756 t   0.0  0.8   0:02.00 plasma-desktop 

On a machine with 8GB of physical RAM and swap turned off this quickly gets you to the limit of OOM killing other apps (kwin + plasma-desktop + consolekit all using 1>GB, and then icedove+iceweasel too).

After some debugging I've traced the culprit to libqt4-script called from the 'Device Notifier' widget:
#1  0x00000033b1ca2dbc in FixedVMPoolAllocator (totalHeapSize=2147483648, commonSize=<optimized out>, this=0x1763a70)
    at ../3rdparty/javascriptcore/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp:308
308             m_base = mmap(reinterpret_cast<void*>(randomLocation), m_totalHeapSize, INITIAL_PROTECTION_FLAGS, MAP_PRIVATE | MAP_ANON | MAP_NORESERVE, VM_TAG_FOR_EXECUTABLEALLOCATOR_MEMORY, 0);

(gdb) print m_totalHeapSize 
$6 = 2147483648

So apparently some Javascript JIT maps 2GB of executable memory, due to:
#if CPU(X86_64)
    // These limits suitable on 64-bit platforms (particularly x86-64, where we require all jumps to have a 2Gb max range).
    #define VM_POOL_SIZE (2u * 1024u * 1024u * 1024u) // 2Gb

See here for some discussions upstream, but leading to no solution (still allocates 2GB):
https://bugs.webkit.org/show_bug.cgi?id=42756

It seems silly to allocate 2GB just to avoid having jumps crossing 2GB boundaries, when there is a dedicated mmap() flag that ensures all addresses are within 1st 2GB: MAP_32BIT.

I'd suggest to use that flag and set the VM_POOL_SIZE to 32MB like it is for 32-bit apps.

It would be best if the JIT could also be disabled at runtime for libqt4-script, for applications that don't strictly require it, like plasma, etc.

Full backtrace:

#0  0x0000003134ce43ca in mmap64 () at ../sysdeps/unix/syscall-template.S:81
#1  0x00000033b1ca2dbc in FixedVMPoolAllocator (totalHeapSize=2147483648, commonSize=<optimized out>, this=0x1763a70)
    at ../3rdparty/javascriptcore/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp:308
#2  QTJSC::ExecutablePool::systemAlloc (size=size@entry=16384)
    at ../3rdparty/javascriptcore/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp:443
#3  0x00000033b1d27a99 in ExecutablePool (n=<optimized out>, this=0x7fffe40de960)
    at ../3rdparty/javascriptcore/JavaScriptCore/jit/ExecutableAllocator.h:258
#4  create (n=<optimized out>) at ../3rdparty/javascriptcore/JavaScriptCore/jit/ExecutableAllocator.h:97
#5  ExecutableAllocator (this=0x7fffe40d89c8) at ../3rdparty/javascriptcore/JavaScriptCore/jit/ExecutableAllocator.h:150
#6  QTJSC::JSGlobalData::JSGlobalData (this=0x7fffe40d7800, isShared=<optimized out>)
    at ../3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalData.cpp:146
#7  0x00000033b1d2825c in QTJSC::JSGlobalData::create ()
    at ../3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalData.cpp:205
#8  0x00000033b1dc87e0 in QScriptEnginePrivate::QScriptEnginePrivate (this=0x159fa70) at api/qscriptengine.cpp:979
#9  0x00000033b1dc97d6 in QScriptEngine::QScriptEngine (this=0x159f538) at api/qscriptengine.cpp:1964
#10 0x00000033b37b362c in QDeclarativeScriptEngine::QDeclarativeScriptEngine (this=0x159f538, priv=0x159f430)
    at qml/qdeclarativeengine.cpp:385
#11 0x00000033b37bc54f in QDeclarativeEnginePrivate::QDeclarativeEnginePrivate (this=0x159f430, e=0x10295c0)
    at qml/qdeclarativeengine.cpp:356
#12 0x00000033b37bc831 in QDeclarativeEngine::QDeclarativeEngine (this=0x10295c0, parent=0x18c5e30)
    at qml/qdeclarativeengine.cpp:642
#13 0x00007ffff79d49c4 in Plasma::DeclarativeWidget::DeclarativeWidget (this=0x18c5e30, parent=<optimized out>)
    at ../../plasma/widgets/declarativewidget.cpp:196
#14 0x00007fffdedca08f in ?? () from /usr/lib/kde4/plasma_appletscript_declarative.so
#15 0x00007ffff790310f in Plasma::Applet::init (this=0x9d4ad0) at ../../plasma/applet.cpp:249
#16 0x00007fffed65dd57 in SystemTray::PlasmoidTask::createWidget (this=0x13660a0, host=0xa84300)
    at /tmp/kde-workspace-4.8.4/plasma/generic/applets/systemtray/protocols/plasmoid/plasmoidtask.cpp:105
#17 0x00007fffed64facc in SystemTray::Task::widget (this=0x13660a0, host=0xa84300, createIfNecessary=true)
    at /tmp/kde-workspace-4.8.4/plasma/generic/applets/systemtray/core/task.cpp:79
#18 0x00007fffed67415b in SystemTray::TaskArea::addWidgetForTask (this=0xcd4b20, task=0x13660a0)
    at /tmp/kde-workspace-4.8.4/plasma/generic/applets/systemtray/ui/taskarea.cpp:265
#19 0x00007fffed673b33 in SystemTray::TaskArea::addTask (this=0xcd4b20, task=0x13660a0)
    at /tmp/kde-workspace-4.8.4/plasma/generic/applets/systemtray/ui/taskarea.cpp:196
#20 0x00007fffed675f96 in SystemTray::TaskArea::qt_static_metacall (_o=0xcd4b20, _c=QMetaObject::InvokeMetaMethod, _id=2, 
    _a=0x7fffffffc660) at /tmp/kde-workspace-4.8.4/plasma/generic/applets/systemtray/taskarea.moc:66
#21 0x00000033b478cdcf in QMetaObject::activate (sender=0x97ad00, m=<optimized out>, local_signal_index=<optimized out>, 
    argv=0x7fffffffc660) at kernel/qobject.cpp:3539
#22 0x00007fffed64e8a7 in SystemTray::Manager::taskAdded (this=0x97ad00, _t1=0x13660a0)
    at /tmp/kde-workspace-4.8.4/plasma/generic/applets/systemtray/manager.moc:113
#23 0x00007fffed64e40a in SystemTray::Manager::addTask (this=0x97ad00, task=0x13660a0)
    at /tmp/kde-workspace-4.8.4/plasma/generic/applets/systemtray/core/manager.cpp:87
#24 0x00007fffed64e743 in SystemTray::Manager::qt_static_metacall (_o=0x97ad00, _c=QMetaObject::InvokeMetaMethod, _id=3, 
    _a=0x7fffffffc870) at /tmp/kde-workspace-4.8.4/plasma/generic/applets/systemtray/manager.moc:63
#25 0x00000033b478cdcf in QMetaObject::activate (sender=0x97dc50, m=<optimized out>, local_signal_index=<optimized out>, 
    argv=0x7fffffffc870) at kernel/qobject.cpp:3539
#26 0x00007fffed64f77f in SystemTray::Protocol::taskCreated (this=0x97dc50, _t1=0x13660a0)
    at /tmp/kde-workspace-4.8.4/plasma/generic/applets/systemtray/protocol.moc:105
#27 0x00007fffed65ba1a in SystemTray::PlasmoidProtocol::addApplet (this=0x97dc50, appletName=..., id=10, parent=0xa84300)
    at /tmp/kde-workspace-4.8.4/plasma/generic/applets/systemtray/protocols/plasmoid/plasmoidtaskprotocol.cpp:112
#28 0x00007fffed65b6d7 in SystemTray::PlasmoidProtocol::loadFromConfig (this=0x97dc50, parent=0xa84300)
    at /tmp/kde-workspace-4.8.4/plasma/generic/applets/systemtray/protocols/plasmoid/plasmoidtaskprotocol.cpp:83
#29 0x00007fffed64e4e1 in SystemTray::Manager::loadApplets (this=0x97ad00, parent=0xa84300)
    at /tmp/kde-workspace-4.8.4/plasma/generic/applets/systemtray/core/manager.cpp:105
#30 0x00007fffed6660be in SystemTray::Applet::configChanged (this=0xa84300)
    at /tmp/kde-workspace-4.8.4/plasma/generic/applets/systemtray/ui/applet.cpp:207
#31 0x00007fffed6664a4 in SystemTray::Applet::constraintsEvent (this=0xa84300, constraints=...)
    at /tmp/kde-workspace-4.8.4/plasma/generic/applets/systemtray/ui/applet.cpp:254
#32 0x00007ffff7909690 in Plasma::Applet::flushPendingConstraintsEvents (this=0xa84300) at ../../plasma/applet.cpp:1365
#33 0x00007ffff7917e92 in Plasma::ContainmentPrivate::initApplets (this=0x9af300) at ../../plasma/containment.cpp:470
#34 0x00007ffff792b85b in Plasma::CoronaPrivate::importLayout (this=0x7a9360, conf=..., mergeConfig=mergeConfig@entry=false)
    at ../../plasma/corona.cpp:1067
#35 0x00007ffff792c4b4 in Plasma::Corona::loadLayout (this=this@entry=0x7100b0, configName=...) at ../../plasma/corona.cpp:278
#36 0x00007ffff792c57c in Plasma::Corona::initializeLayout (this=0x7100b0, configName=...) at ../../plasma/corona.cpp:181
#37 0x00007ffff7db06b1 in PlasmaApp::corona (this=0x675e70, createIfMissing=true)
    at /tmp/kde-workspace-4.8.4/plasma/desktop/shell/plasmaapp.cpp:833
#38 0x00007ffff7dadaba in PlasmaApp::setupDesktop (this=0x675e70)
    at /tmp/kde-workspace-4.8.4/plasma/desktop/shell/plasmaapp.cpp:312
#39 0x00007ffff7db52d5 in PlasmaApp::qt_static_metacall (_o=0x675e70, _c=QMetaObject::InvokeMetaMethod, _id=14, _a=0x67aff0)
    at /tmp/kde-workspace-4.8.4/plasma/desktop/shell/plasmaapp.moc:119
#40 0x00000033b479229e in QObject::event (this=this@entry=0x675e70, e=e@entry=0x7ee700) at kernel/qobject.cpp:1194
#41 0x00000033b477ccfc in QCoreApplication::event (this=this@entry=0x675e70, e=e@entry=0x7ee700)
    at kernel/qcoreapplication.cpp:1758
#42 0x00000033b59d1b74 in QApplication::event (this=0x675e70, e=0x7ee700) at kernel/qapplication.cpp:2549
#43 0x00000033b59ca0ec in QApplicationPrivate::notify_helper (this=this@entry=0x68df60, receiver=receiver@entry=0x675e70, 
    e=e@entry=0x7ee700) at kernel/qapplication.cpp:4567
#44 0x00000033b59cca5b in QApplication::notify (this=this@entry=0x675e70, receiver=receiver@entry=0x675e70, e=e@entry=0x7ee700)
    at kernel/qapplication.cpp:4428
#45 0x00007ffff5769a66 in KApplication::notify (this=0x675e70, receiver=0x675e70, event=0x7ee700)
    at ../../kdeui/kernel/kapplication.cpp:311
#46 0x00000033b47783ae in QCoreApplication::notifyInternal (this=0x675e70, receiver=receiver@entry=0x675e70, 
    event=event@entry=0x7ee700) at kernel/qcoreapplication.cpp:946
#47 0x00000033b477bee1 in sendEvent (event=0x7ee700, receiver=0x675e70)
    at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
#48 QCoreApplicationPrivate::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0, data=0x619160)
    at kernel/qcoreapplication.cpp:1570
#49 0x00000033b477c213 in QCoreApplication::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0)
#50 0x00000033b47a6b53 in sendPostedEvents () at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:236
#51 postEventSourceDispatch (s=0x68d3f0) at kernel/qeventdispatcher_glib.cpp:279
#52 0x00000033af248d95 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#53 0x00000033af2490d8 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#54 0x00000033af249194 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#55 0x00000033b47a6ce6 in QEventDispatcherGlib::processEvents (this=0x61aa40, flags=...) at kernel/qeventdispatcher_glib.cpp:424
#56 0x00000033b5a6bf9e in QGuiEventDispatcherGlib::processEvents (this=<optimized out>, flags=...)
    at kernel/qguieventdispatcher_glib.cpp:204
#57 0x00000033b47770ff in QEventLoop::processEvents (this=this@entry=0x7fffffffdd90, flags=...) at kernel/qeventloop.cpp:149
#58 0x00000033b4777388 in QEventLoop::exec (this=this@entry=0x7fffffffdd90, flags=...) at kernel/qeventloop.cpp:204
#59 0x00000033b477ca66 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1218
#60 0x00007ffff7d92029 in kdemain (argc=2, argv=0x7fffffffe1a8) at /tmp/kde-workspace-4.8.4/plasma/desktop/shell/main.cpp:120
#61 0x0000003134c21a55 in __libc_start_main (main=0x400750, argc=2, ubp_av=0x7fffffffe1a8, init=<optimized out>, 
    fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe198) at libc-start.c:260
#62 0x0000000000400781 in _start ()

--- System information. ---
Architecture: amd64
Kernel:       Linux 3.9.5

Debian Release: jessie/sid
  500 unstable        ftp.ro.debian.org 
  500 stable          security.debian.org 
  500 stable          ftp.ro.debian.org 

--- Package information. ---
Depends                 (Version) | Installed
=================================-+-===================
libc6                   (>= 2.14) | 
libgcc1              (>= 1:4.1.1) | 
libqtcore4     (= 4:4.8.4+dfsg-4) | 
libqtdbus4     (= 4:4.8.4+dfsg-4) | 
libstdc++6             (>= 4.1.1) | 


Package's Recommends field is empty.

Package's Suggests field is empty.


Reply to: