<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>234781</bug_id>
          
          <creation_ts>2010-04-19 10:20:00 +0000</creation_ts>
          <short_desc>javascript plasmoid + python dataengine: Too many open files</short_desc>
          <delta_ts>2010-06-05 00:01:34 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>10</classification_id>
          <classification>Unmaintained</classification>
          <product>plasma4</product>
          <component>general</component>
          <version>unspecified</version>
          <rep_platform>Compiled Sources</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>crash</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Nikita Melnichenko">open-development</reporter>
          <assigned_to name="Plasma Bugs List">plasma-bugs-null</assigned_to>
          <cc>aseigo</cc>
    
    <cc>ulf.sauer</cc>
          
          <cf_commitlink></cf_commitlink>
          <cf_versionfixedin></cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>60</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>951415</commentid>
    <comment_count>0</comment_count>
    <who name="Nikita Melnichenko">open-development</who>
    <bug_when>2010-04-19 10:20:00 +0000</bug_when>
    <thetext>Application: plasmoidviewer (1.0)
KDE Platform Version: 4.4.2 (KDE 4.4.2) (Compiled from sources)
Qt Version: 4.6.2
Operating System: Linux 2.6.33.1-c2 x86_64
Distribution (Platform): Gentoo Packages

-- Information about the crash:
My Make Progress! plasmoid crashes (and crash Plasma, of course) when it have many live items or they&apos;re frequently updated. I investigated this bug and created a small plasmoid that has the same crash. That should ease debugging.

Futher information and sample plasmoid would be in comments.

The crash can be reproduced every time.

 -- Backtrace:
Application: Просмотр виджета Plasma (plasmoidviewer), signal: Bus error
The current source language is &quot;auto; currently c&quot;.
[Current thread is 1 (Thread 0x7f9021bab790 (LWP 7651))]

Thread 2 (Thread 0x7f9008a1b910 (LWP 7652)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:261
#1  0x00007f9008b4421a in QTWTF::TCMalloc_PageHeap::scavengerThread (this=0x7f9008e1c200) at ../3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp:2304
#2  0x00007f9008b4424f in QTWTF::TCMalloc_PageHeap::runScavengerThread (context=0x7f9008e2a2cc) at ../3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp:1438
#3  0x00007f902028d2a7 in start_thread (arg=&lt;value optimized out&gt;) at pthread_create.c:297
#4  0x00007f901ea008cd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#5  0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7f9021bab790 (LWP 7651)):
[KCrash Handler]
#5  0x00007f90205d67a1 in QProcessPrivate::waitForStarted (this=0x320a790, msecs=30000) at io/qprocess_unix.cpp:912
#6  0x00007f902059be63 in QProcess::waitForStarted (this=0x3209b70, msecs=30000) at io/qprocess.cpp:1611
#7  0x00007f901c6cabcc in KProcessRunner (this=0x3209010, p=0x3209b70, executable=..., _id=...) at /var/tmp/portage/kde-base/kdelibs-4.4.2/work/kdelibs-4.4.2/kio/kio/krun.cpp:1649
#8  0x00007f901c6cac3c in KProcessRunner::run (p=0x3209b70, executable=..., id=...) at /var/tmp/portage/kde-base/kdelibs-4.4.2/work/kdelibs-4.4.2/kio/kio/krun.cpp:1631
#9  0x00007f901c6cb84b in runCommandInternal (proc=0x3209b70, service=0x3207010, executable=..., userVisibleName=..., iconName=..., window=0x0, asn=...)
    at /var/tmp/portage/kde-base/kdelibs-4.4.2/work/kdelibs-4.4.2/kio/kio/krun.cpp:572
#10 0x00007f901c6cbda1 in KRun::runCommand (cmd=..., execName=..., iconName=..., window=0x0, asn=..., workingDirectory=...)
    at /var/tmp/portage/kde-base/kdelibs-4.4.2/work/kdelibs-4.4.2/kio/kio/krun.cpp:1046
#11 0x00007f901c6cbfb1 in KRun::runCommand (cmd=..., window=0x0, workingDirectory=...) at /var/tmp/portage/kde-base/kdelibs-4.4.2/work/kdelibs-4.4.2/kio/kio/krun.cpp:1020
#12 0x00007f901c6cc170 in KRun::runCommand (cmd=..., window=0x7530) at /var/tmp/portage/kde-base/kdelibs-4.4.2/work/kdelibs-4.4.2/kio/kio/krun.cpp:1010
#13 0x00007f9008e47d9a in SimpleJavaScriptApplet::runCommand (context=0x7fff8af4fcf0, engine=&lt;value optimized out&gt;)
    at /var/tmp/portage/kde-base/plasma-runtime-4.4.2/work/plasma-runtime-4.4.2/plasma/scriptengines/javascript/simplejavascriptapplet.cpp:388
#14 0x00007f9008b7f3e2 in QScript::FunctionWrapper::proxyCall (exec=&lt;value optimized out&gt;, callee=0x7f9007c90b00, thisObject=&lt;value optimized out&gt;, args=&lt;value optimized out&gt;)
    at bridge/qscriptfunction.cpp:82
#15 0x00007f9008ac61f2 in QTJSC::NativeFuncWrapper::operator() (this=0x7fff8af50240, exec=0x7f9007d030a8, jsobj=0x7f9007c90b00, thisValue=..., argList=...)
    at ../3rdparty/javascriptcore/JavaScriptCore/runtime/CallData.cpp:46
#16 0x00007f9008ab4c8a in QTJSC::Interpreter::privateExecute (this=0x7f9008124b00, flag=&lt;value optimized out&gt;, registerFile=0x7f9008124b10, callFrame=0x7f9007d03048, exception=0x7f90081199b8)
    at ../3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp:3103
#17 0x00007f9008ab6569 in QTJSC::Interpreter::execute (this=0x7f9008124b00, functionExecutable=0x7f900816ba50, callFrame=0x1a73c48, function=0x7f9007c90d80, thisObj=&lt;value optimized out&gt;, args=..., 
    scopeChain=0x7f900811f4b0, exception=0x7f90081199b8) at ../3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.cpp:753
#18 0x00007f9008aef9d8 in QTJSC::JSFunction::call (this=0x7f9007c90d80, exec=0x1a73c48, thisValue=..., args=...) at ../3rdparty/javascriptcore/JavaScriptCore/runtime/JSFunction.cpp:120
#19 0x00007f9008ac621c in QTJSC::call (exec=&lt;value optimized out&gt;, functionObject=..., callType=&lt;value optimized out&gt;, callData=..., thisValue=..., args=...)
    at ../3rdparty/javascriptcore/JavaScriptCore/runtime/CallData.cpp:62
#20 0x00007f9008b896a0 in QScript::QObjectConnectionManager::execute (this=0x239ea50, slotIndex=&lt;value optimized out&gt;, argv=&lt;value optimized out&gt;) at bridge/qscriptqobject.cpp:2220
#21 0x00007f9008b899f3 in QScript::QObjectConnectionManager::qt_metacall (this=0x239ea50, _c=QMetaObject::InvokeMetaMethod, _id=63, _a=0x7fff8af50df0) at bridge/qscriptqobject.cpp:2127
#22 0x00007f90206099f0 in QMetaObject::activate (sender=0x1a483e0, m=&lt;value optimized out&gt;, local_signal_index=&lt;value optimized out&gt;, argv=0x0) at kernel/qobject.cpp:3285
#23 0x00007f90211c00a2 in Plasma::PushButton::qt_metacall (this=0x1a483e0, _c=QMetaObject::InvokeMetaMethod, _id=&lt;value optimized out&gt;, _a=0x7fff8af50f90)
    at /var/tmp/portage/kde-base/kdelibs-4.4.2/work/kdelibs-4.4.2_build/plasma/pushbutton.moc:101
#24 0x00007f90206099f0 in QMetaObject::activate (sender=0x1ab2bd0, m=&lt;value optimized out&gt;, local_signal_index=&lt;value optimized out&gt;, argv=0x0) at kernel/qobject.cpp:3285
#25 0x00007f901fbe1b60 in QAbstractButton::clicked (this=0x7fff8af4f8b0, _t1=false) at .moc/release-shared/moc_qabstractbutton.cpp:206
#26 0x00007f901f93e2b8 in QAbstractButtonPrivate::emitClicked (this=0x1ef7710) at widgets/qabstractbutton.cpp:546
#27 0x00007f901f93ef5a in QAbstractButtonPrivate::click (this=0x1ef7710) at widgets/qabstractbutton.cpp:539
#28 0x00007f901f93f14c in QAbstractButton::mouseReleaseEvent (this=0x1ab2bd0, e=0x3204f10) at widgets/qabstractbutton.cpp:1121
#29 0x00007f901f629e38 in QWidget::event (this=0x1ab2bd0, event=0x3204f10) at kernel/qwidget.cpp:7998
#30 0x00007f901f5dc3d6 in QApplicationPrivate::notify_helper (this=0x18ded60, receiver=0x1ab2bd0, e=0x3204f10) at kernel/qapplication.cpp:4300
#31 0x00007f901f5e3b3d in QApplication::notify (this=&lt;value optimized out&gt;, receiver=0x1ab2bd0, e=0x3204f10) at kernel/qapplication.cpp:3865
#32 0x00007f90216de754 in KApplication::notify (this=0x7fff8af53ca0, receiver=0x1ab2bd0, event=0x3204f10)
    at /var/tmp/portage/kde-base/kdelibs-4.4.2/work/kdelibs-4.4.2/kdeui/kernel/kapplication.cpp:302
#33 0x00007f90205f82f4 in QCoreApplication::notifyInternal (this=0x7fff8af53ca0, receiver=0x1ab2bd0, event=0x3204f10) at kernel/qcoreapplication.cpp:704
#34 0x00007f901f5e1d3b in QCoreApplication::sendEvent (receiver=0x1ab2bd0, event=0x3204f10, alienWidget=0x0, nativeWidget=0x1ab2bd0, buttonDown=0x7fff8af519a8, lastMouseReceiver=..., spontaneous=
    true) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:215
#35 QApplicationPrivate::sendMouseEvent (receiver=0x1ab2bd0, event=0x3204f10, alienWidget=0x0, nativeWidget=0x1ab2bd0, buttonDown=0x7fff8af519a8, lastMouseReceiver=..., spontaneous=true)
    at kernel/qapplication.cpp:2965
#36 0x00007f901fb5da4d in QGraphicsProxyWidgetPrivate::sendWidgetMouseEvent (this=0x1ef7200, event=0x7fff8af52330) at graphicsview/qgraphicsproxywidget.cpp:283
#37 0x00007f901fb4dbf9 in QGraphicsItem::sceneEvent (this=0x1a483f0, event=0x7530) at graphicsview/qgraphicsitem.cpp:6499
#38 0x00007f901fb61674 in QGraphicsScenePrivate::sendMouseEvent (this=0x19e0f90, mouseEvent=0x7fff8af52330) at graphicsview/qgraphicsscene.cpp:1255
#39 0x00007f901fb65394 in QGraphicsScene::mouseReleaseEvent (this=&lt;value optimized out&gt;, mouseEvent=0x7fff8af52330) at graphicsview/qgraphicsscene.cpp:4057
#40 0x00007f901fb74e81 in QGraphicsScene::event (this=0x7fff8af53b48, event=0x7fff8af52330) at graphicsview/qgraphicsscene.cpp:3398
#41 0x00007f901f5dc3d6 in QApplicationPrivate::notify_helper (this=0x18ded60, receiver=0x7fff8af53b48, e=0x7fff8af52330) at kernel/qapplication.cpp:4300
#42 0x00007f901f5e2e74 in QApplication::notify (this=0x7fff8af53ca0, receiver=0x7fff8af53b48, e=0x7fff8af52330) at kernel/qapplication.cpp:3704
#43 0x00007f90216de754 in KApplication::notify (this=0x7fff8af53ca0, receiver=0x7fff8af53b48, event=0x7fff8af52330)
    at /var/tmp/portage/kde-base/kdelibs-4.4.2/work/kdelibs-4.4.2/kdeui/kernel/kapplication.cpp:302
#44 0x00007f90205f82f4 in QCoreApplication::notifyInternal (this=0x7fff8af53ca0, receiver=0x7fff8af53b48, event=0x7fff8af52330) at kernel/qcoreapplication.cpp:704
#45 0x00007f901fb8d6bc in QGraphicsView::mouseReleaseEvent (this=0x7fff8af53b20, event=0x7fff8af52f80) at graphicsview/qgraphicsview.cpp:3259
#46 0x00007f901f629e38 in QWidget::event (this=0x7fff8af53b20, event=0x7fff8af52f80) at kernel/qwidget.cpp:7998
#47 0x00007f901f97edc6 in QFrame::event (this=0x7fff8af53b20, e=0x7fff8af52f80) at widgets/qframe.cpp:557
#48 0x00007f901fb8af29 in QGraphicsView::viewportEvent (this=0x7fff8af53b20, event=0x7fff8af52f80) at graphicsview/qgraphicsview.cpp:2787
#49 0x00007f90205f793a in QCoreApplicationPrivate::sendThroughObjectEventFilters (this=&lt;value optimized out&gt;, receiver=0x19e0560, event=0x7fff8af52f80) at kernel/qcoreapplication.cpp:819
#50 0x00007f901f5dc3b5 in QApplicationPrivate::notify_helper (this=0x18ded60, receiver=0x19e0560, e=0x7fff8af52f80) at kernel/qapplication.cpp:4296
#51 0x00007f901f5e3b3d in QApplication::notify (this=&lt;value optimized out&gt;, receiver=0x19e0560, e=0x7fff8af52f80) at kernel/qapplication.cpp:3865
#52 0x00007f90216de754 in KApplication::notify (this=0x7fff8af53ca0, receiver=0x19e0560, event=0x7fff8af52f80)
    at /var/tmp/portage/kde-base/kdelibs-4.4.2/work/kdelibs-4.4.2/kdeui/kernel/kapplication.cpp:302
#53 0x00007f90205f82f4 in QCoreApplication::notifyInternal (this=0x7fff8af53ca0, receiver=0x19e0560, event=0x7fff8af52f80) at kernel/qcoreapplication.cpp:704
#54 0x00007f901f5e1d3b in QCoreApplication::sendEvent (receiver=0x19e0560, event=0x7fff8af52f80, alienWidget=0x19e0560, nativeWidget=0x7fff8af53b20, buttonDown=0x7f902002a9e8, lastMouseReceiver=..., 
    spontaneous=true) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:215
#55 QApplicationPrivate::sendMouseEvent (receiver=0x19e0560, event=0x7fff8af52f80, alienWidget=0x19e0560, nativeWidget=0x7fff8af53b20, buttonDown=0x7f902002a9e8, lastMouseReceiver=..., spontaneous=
    true) at kernel/qapplication.cpp:2965
#56 0x00007f901f6587ed in QETWidget::translateMouseEvent (this=0x7fff8af53b20, event=&lt;value optimized out&gt;) at kernel/qapplication_x11.cpp:4368
#57 0x00007f901f657745 in QApplication::x11ProcessEvent (this=0x7fff8af53ca0, event=0x7fff8af53760) at kernel/qapplication_x11.cpp:3501
#58 0x00007f901f67d78a in x11EventSourceDispatch (s=0x18e29f0, callback=0, user_data=0x0) at kernel/qguieventdispatcher_glib.cpp:146
#59 0x00007f9018d7b073 in g_main_dispatch (context=0x18e1920) at gmain.c:1960
#60 IA__g_main_context_dispatch (context=0x18e1920) at gmain.c:2513
#61 0x00007f9018d7e16c in g_main_context_iterate (context=0x18e1920, block=1, dispatch=1, self=&lt;value optimized out&gt;) at gmain.c:2591
#62 0x00007f9018d7e2ee in IA__g_main_context_iteration (context=0x18e1920, may_block=1) at gmain.c:2654
#63 0x00007f902061dc74 in QEventDispatcherGlib::processEvents (this=0x18c53d0, flags=&lt;value optimized out&gt;) at kernel/qeventdispatcher_glib.cpp:412
#64 0x00007f901f67d3a6 in QGuiEventDispatcherGlib::processEvents (this=0x7fff8af4f8b0, flags=&lt;value optimized out&gt;) at kernel/qguieventdispatcher_glib.cpp:204
#65 0x00007f90205f6fb4 in QEventLoop::processEvents (this=&lt;value optimized out&gt;, flags=...) at kernel/qeventloop.cpp:149
#66 0x00007f90205f72ff in QEventLoop::exec (this=0x7fff8af53a90, flags=...) at kernel/qeventloop.cpp:201
#67 0x00007f90205f92de in QCoreApplication::exec () at kernel/qcoreapplication.cpp:981
#68 0x000000000040aa2d in main (argc=2, argv=0x7fff8af54598) at /var/tmp/portage/kde-base/plasma-workspace-4.4.2/work/plasma-workspace-4.4.2/plasma/generic/shells/plasmoidviewer/main.cpp:231
The current source language is &quot;auto; currently asm&quot;.
The current source language is &quot;auto; currently c&quot;.

Reported using DrKonqi</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>951433</commentid>
    <comment_count>1</comment_count>
      <attachid>42889</attachid>
    <who name="Nikita Melnichenko">open-development</who>
    <bug_when>2010-04-19 11:01:51 +0000</bug_when>
    <thetext>Created attachment 42889
plasmoid that&apos;s crashed

The Make Progress data engine should be installed:
http://nikita.melnichenko.name/download.php?q=make-progress-0.1.0.engine

Steps to reprodice:
1. run in plasmoidviewer
You will see many strings in console like that:
plasmoidviewer(14515)/kdecore (KConfigSkeleton) KCoreConfigSkeleton::writeConfig:
They will be mixed with replies from engine.
2. click the button, notification should appear
3. wait until replies stop printing (there would be only writeConfig lines)
4. click again -&gt; crash</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>951441</commentid>
    <comment_count>2</comment_count>
    <who name="Nikita Melnichenko">open-development</who>
    <bug_when>2010-04-19 11:20:38 +0000</bug_when>
    <thetext>There are also these messages in console before crash:

plasmoidviewer(14515)/kdecore (KConfigSkeleton) KCoreConfigSkeleton::writeConfig:
plasmoidviewer(14515)/kdecore (KConfigSkeleton) KCoreConfigSkeleton::writeConfig:
plasmoidviewer(14515)/kdecore (KConfigSkeleton) KCoreConfigSkeleton::writeConfig:
plasmoidviewer(14515): Failed to lock file &quot;/var/tmp/kdecache-nikita/kpc/plasma_theme_default.lock&quot; , last result = 2 
plasmoidviewer(14515): Failed to lock file &quot;/var/tmp/kdecache-nikita/kpc/plasma_theme_default.lock&quot; , last result = 2 
plasmoidviewer(14515): Failed to lock file &quot;/var/tmp/kdecache-nikita/kpc/plasma_theme_default.lock&quot; , last result = 2 
plasmoidviewer(14515): Failed to lock file &quot;/var/tmp/kdecache-nikita/kpc/plasma_theme_default.lock&quot; , last result = 2 
plasmoidviewer(14515): Failed to lock file &quot;/var/tmp/kdecache-nikita/kpc/plasma_theme_default.lock&quot; , last result = 2 
plasmoidviewer(14515): Failed to lock file &quot;/var/tmp/kdecache-nikita/kpc/plasma_theme_default.lock&quot; , last result = 2 
plasmoidviewer(14515): Failed to lock file &quot;/var/tmp/kdecache-nikita/kpc/plasma_theme_default.lock&quot; , last result = 2 
plasmoidviewer(14515): Failed to lock file &quot;/var/tmp/kdecache-nikita/kpc/plasma_theme_default.lock&quot; , last result = 2 
plasmoidviewer(14515): Failed to lock file &quot;/var/tmp/kdecache-nikita/kpc/plasma_theme_default.lock&quot; , last result = 2 
plasmoidviewer(14515): Failed to lock file &quot;/var/tmp/kdecache-nikita/kpc/plasma_theme_default.lock&quot; , last result = 2 
plasmoidviewer(14515)/kdecore (KConfigSkeleton) KCoreConfigSkeleton::writeConfig:
clicked
QProcessPrivate::createPipe: Cannot create pipe 0x2d1fd28: Too many open files
QSocketNotifier: Invalid socket specified
QProcessPrivate::createPipe: Cannot create pipe 0x2d1fd50: Too many open files
QSocketNotifier: Invalid socket specified
QProcessPrivate::createPipe: Cannot create pipe 0x2d1fd78: Too many open files
QSocketNotifier: Invalid socket specified
QProcessPrivate::createPipe: Cannot create pipe 0x2d1fe00: Too many open files
QProcessPrivate::createPipe: Cannot create pipe 0x2d1fe08: Too many open files
QSocketNotifier: Invalid socket specified
QSocketNotifier: Invalid socket specified
KCrash: Application &apos;plasmoidviewer&apos; crashing...
sock_file=/home/nikita/.kde4/socket-razor/kdeinit4__0

[1]+  Stopped                 plasmoidviewer .


This is why a button is needed - to force opening a new file. These messages show that bug#232973 is probably the same issue. Plasma can&apos;t lock plasma_theme_default.lock so it can&apos;t show any icons.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>952211</commentid>
    <comment_count>3</comment_count>
    <who name="Ulf Sauer">ulf.sauer</who>
    <bug_when>2010-04-21 14:17:20 +0000</bug_when>
    <thetext>I can confirm this on my machine.
Steps to reproduce:

1. Download Make-Progress Engine 0.1.1 and Plasmoid 0.1.0
http://nikita.melnichenko.name/download.php?q=make-progress-latest.engine
http://nikita.melnichenko.name/download.php?q=make-progress-0.1.0.plasmoid

2. Install engine
$ plasmapkg -u make-progress-0.1.1.engine -t dataengine

3. Extract and start plasmoid
$ unzip make-progress-0.1.0.plasmoid -d plasmoid-make-progress
$ plasmoidviewer plasmoid-make-progress

4A. Add one long timer (min. 4 minutes) manually or via dbus, then start it
$ TIMER=$(qdbus name.melnichenko.nikita.make-progress.plasmoid / AddItem Timer); qdbus name.melnichenko.nikita.make-progress.plasmoid /$TIMER SetMaximum 240000; qdbus name.melnichenko.nikita.make-progress.plasmoid /$TIMER Start

4B. Instead of using one long timer, you can add multiple short timers (e.g. 8 x 10 seconds). This way you do not have to wait 4 minutes ;)
$ for i in {1..8};do TIMER=$(qdbus name.melnichenko.nikita.make-progress.plasmoid / AddItem Timer);qdbus name.melnichenko.nikita.make-progress.plasmoid /$TIMER SetMaximum 10000; qdbus name.melnichenko.nikita.make-progress.plasmoid /$TIMER Start;sleep 1s; done

5. plasmoidviewer/plasma crashes as soon as the first timer is done.

Versions:
KDE SC: 4.4.2
Qt: 4.6.2
Python: 2.6.4
PyQt: 4.7.2


end of output:
[...]
[Make progress!] Notification: Task e3 is complete.
QProcessPrivate::createPipe: Cannot create pipe 0xab108e0: Too many open files
QSocketNotifier: Invalid socket specified
QProcessPrivate::createPipe: Cannot create pipe 0xab108f8: Too many open files
QSocketNotifier: Invalid socket specified
QProcessPrivate::createPipe: Cannot create pipe 0xab10910: Too many open files
QSocketNotifier: Invalid socket specified
QProcessPrivate::createPipe: Cannot create pipe 0xab10970: Too many open files
QProcessPrivate::createPipe: Cannot create pipe 0xab10978: Too many open files
QSocketNotifier: Invalid socket specified
QSocketNotifier: Invalid socket specified
KCrash: Application &apos;plasmoidviewer&apos; crashing...


Crashlog:
 Application: Plasma-Miniprogramm-Anzeige (plasmoidviewer), signal: Segmentation fault
[Current thread is 1 (Thread 0xb77b4710 (LWP 10270))]

Thread 2 (Thread 0xac643b70 (LWP 10272)):
#0  0x00e75422 in __kernel_vsyscall ()
#1  0x00dcbe15 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/i686/cmov/libpthread.so.0
#2  0x0354487d in pthread_cond_wait () from /lib/tls/i686/cmov/libc.so.6
#3  0x02ba6887 in ?? () from /usr/lib/libQtScript.so.4
#4  0x02ba68d1 in ?? () from /usr/lib/libQtScript.so.4
#5  0x00dc780e in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#6  0x035378de in clone () from /lib/tls/i686/cmov/libc.so.6

Thread 1 (Thread 0xb77b4710 (LWP 10270)):
[KCrash Handler]
#6  0x009a2869 in ?? () from /usr/lib/libQtCore.so.4
#7  0x0095ef7f in QProcess::waitForStarted(int) () from /usr/lib/libQtCore.so.4
#8  0x01a3b4d5 in ?? () from /usr/lib/libkio.so.5
#9  0x01a3b562 in ?? () from /usr/lib/libkio.so.5
#10 0x01a3c362 in ?? () from /usr/lib/libkio.so.5
#11 0x01a3c9ee in KRun::runCommand(QString const&amp;, QString const&amp;, QString const&amp;, QWidget*, QByteArray const&amp;, QString const&amp;) () from /usr/lib/libkio.so.5
#12 0x01a3cc58 in KRun::runCommand(QString const&amp;, QWidget*, QString const&amp;) () from /usr/lib/libkio.so.5
#13 0x01a3ce6a in KRun::runCommand(QString const&amp;, QWidget*) () from /usr/lib/libkio.so.5
#14 0x081ea5df in ?? () from /usr/lib/kde4/plasma_appletscript_simple_javascript.so
#15 0x02beb07b in ?? () from /usr/lib/libQtScript.so.4
#16 0x02b12db0 in ?? () from /usr/lib/libQtScript.so.4
#17 0x02ab0c0c in ?? () from /usr/lib/libQtScript.so.4
#18 0x028c4737 in ?? ()
#19 0x02ad8471 in ?? () from /usr/lib/libQtScript.so.4
#20 0x02b41a1d in ?? () from /usr/lib/libQtScript.so.4
#21 0x02b12e0e in ?? () from /usr/lib/libQtScript.so.4
#22 0x02b49333 in ?? () from /usr/lib/libQtScript.so.4
#23 0x02beccc5 in ?? () from /usr/lib/libQtScript.so.4
#24 0x02ab0f1d in ?? () from /usr/lib/libQtScript.so.4
#25 0x028c0aad in ?? ()
#26 0x02ad8471 in ?? () from /usr/lib/libQtScript.so.4
#27 0x02b41a1d in ?? () from /usr/lib/libQtScript.so.4
#28 0x02b12e0e in ?? () from /usr/lib/libQtScript.so.4
#29 0x02bf7d63 in ?? () from /usr/lib/libQtScript.so.4
#30 0x02bf8146 in ?? () from /usr/lib/libQtScript.so.4
#31 0x009cde5a in QMetaObject::metacall(QObject*, QMetaObject::Call, int, void**) () from /usr/lib/libQtCore.so.4
#32 0x009dc5f5 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4
#33 0x00a2dc97 in QTimer::timeout() () from /usr/lib/libQtCore.so.4
#34 0x009e479e in QTimer::timerEvent(QTimerEvent*) () from /usr/lib/libQtCore.so.4
#35 0x009d9494 in QObject::event(QEvent*) () from /usr/lib/libQtCore.so.4
#36 0x00fab3cc in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#37 0x00fb201e in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#38 0x006595ba in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdeui.so.5
#39 0x009c8beb in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4
#40 0x009f7eb6 in ?? () from /usr/lib/libQtCore.so.4
#41 0x009f4b47 in ?? () from /usr/lib/libQtCore.so.4
#42 0x01bfee88 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#43 0x01c02730 in ?? () from /lib/libglib-2.0.so.0
#44 0x01c02863 in g_main_context_iteration () from /lib/libglib-2.0.so.0
#45 0x009f4805 in QEventDispatcherGlib::processEvents(QFlags&lt;QEventLoop::ProcessEventsFlag&gt;) () from /usr/lib/libQtCore.so.4
#46 0x0106ab35 in ?? () from /usr/lib/libQtGui.so.4
#47 0x009c7209 in QEventLoop::processEvents(QFlags&lt;QEventLoop::ProcessEventsFlag&gt;) () from /usr/lib/libQtCore.so.4
#48 0x009c765a in QEventLoop::exec(QFlags&lt;QEventLoop::ProcessEventsFlag&gt;) () from /usr/lib/libQtCore.so.4
#49 0x009cb84f in QCoreApplication::exec() () from /usr/lib/libQtCore.so.4
#50 0x00fab467 in QApplication::exec() () from /usr/lib/libQtGui.so.4
#51 0x08050bf7 in _start ()</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>958556</commentid>
    <comment_count>4</comment_count>
    <who name="Aaron J. Seigo">aseigo</who>
    <bug_when>2010-05-08 01:43:27 +0000</bug_when>
    <thetext>what command is getting run (as apparently there is a call to runCommand there) and how often is it getting called?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>958795</commentid>
    <comment_count>5</comment_count>
    <who name="Nikita Melnichenko">open-development</who>
    <bug_when>2010-05-08 16:00:37 +0000</bug_when>
    <thetext>It&apos;s a python, if I understood you right. Here it is:
plasmoid.runCommand(&quot;python&quot;, [ plasmoid.file(&quot;&quot;, &quot;scripts/knotify.py&quot;), &quot;Notification&quot;,  &quot;title&quot;,  &quot;clicked&quot;, &quot;3000&quot;]);
Actually, it&apos;s not the reason because it just starts a new QProcess which needs a new file descriptor, and Plasma (or plasmoidviewer, whatever) is out of free descriptors at that moment. So it&apos;s just a &quot;crash initiator&quot;, I believe.

The problem is somewhere between service.startOperationCall and plasmoid.dataUpdated. They are called very often. It seems that startOperationCall opens a new descriptor each time and forgets to close it. Something like that. That&apos;s why Plasma has no more descriptors in the moment of crash.

Have you tried to reproduce it with the attached plasmoid I specially created for this bug report? It&apos;s much smaller that Make Progress plasmoid and should be a good testcase. The crash can be reproduced every time on my system. I hope it could help you. Thanks for attention.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>959529</commentid>
    <comment_count>6</comment_count>
    <who name="Nikita Melnichenko">open-development</who>
    <bug_when>2010-05-09 23:32:20 +0000</bug_when>
    <thetext>I spent few hours today by looking for the reason of descriptor leak. It seems I have found what&apos;s causing it. This knowledge even helped me to make a walk-around for this issue in my plasmoid.

The problem was in the serviceForSource. Each time it had been called, the new instance of Service object is created and registerOperationsScheme is called (which calls setOperationsScheme). It needs a QFile object and lives with it (don&apos;t understand why it should live with it, we probably need read-and-forget pattern here). For some reason (buggy Plasma?) the service objects are never freed, so the number of QFile objects increases (btw, the memory leak grows too). At some point Plasma can&apos;t open new files and crashes (here is the second bug).

The walk-around is to save created objects and return these instances on further requests. However this fix is not complete: user can actively create and delete progress items and we must create new instances of ServiceProgressProps class. Anyway, this walk-around covers the most of cases and needs to be applied.

To sum up. I think there are two bugs here:
1. Service objects are not freed, i.e. if serviceForSource returns a new object for the same source, older isn&apos;t destroyed.
2. When Plasma is out of file descriptors, runCommand makes segfault.

and one question:
Why descriptor is needed for service?
I looked through code of Service::setOperationsScheme and didn&apos;t understood FIXME message:
    //FIXME: make KSharedConfig and KConfigSkeleton not braindamaged in 4.2 and then get rid of the
    //       temp file object here
    d-&gt;tempFile = new KTemporaryFile;
    d-&gt;tempFile-&gt;open();

Here d-&gt;tempFile is probably a descriptor that lives with a service. It must be deleted right in the end of that function, isn&apos;t it?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>967477</commentid>
    <comment_count>7</comment_count>
    <who name="KOPRajs">zdenek.koprivik</who>
    <bug_when>2010-05-26 16:12:14 +0000</bug_when>
    <thetext>*** This bug has been confirmed by popular vote. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>967514</commentid>
    <comment_count>8</comment_count>
    <who name="Aaron J. Seigo">aseigo</who>
    <bug_when>2010-05-26 18:00:00 +0000</bug_when>
    <thetext>&quot;For some reason (buggy Plasma?) the service objects are never freed&quot;

from the api documentation: &quot;The service is parented to the DataEngine, but may be deleted by the caller when finished with it.&quot; I&apos;ll change &quot;may be&quot; to &quot;should be&quot;, but the meaning should really be clear already: Service objects are created on demand and really belong to the caller.

&quot;The walk-around is to save created objects and return these instances on
further requests&quot;

if you are doing this in the DataEninge, then this will eventually lead to crashes due to dangling pointers being held on to by the various users of the DataEngine&apos;s services when one of them deletes a Service (which is not only valid, it&apos;s how Services should be used).

if you are caching the Service objects in the Plasmoid, then yes, that&apos;s the correct approach.

&quot;Here d-&gt;tempFile is probably a descriptor that lives with a service. It must be
deleted right in the end of that function, isn&apos;t it?&quot;

no, because that KConfig object is required to make all the KConfigGroup reading/writing work properly. it needs to live as long as the service does. the problem here is that there is no &quot;in memory&quot; KConfigBackend to be used with KConfigBase, which would make the entire thing not require any file access at all beyond reading in the .operations file when the service is created.

In any case, the root of this particular bug is due to holding on to service objects indefinitely; even without the file descriptors it will lead to a growing usage of memory. Fix the plasmoid. :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>970312</commentid>
    <comment_count>9</comment_count>
    <who name="Nikita Melnichenko">open-development</who>
    <bug_when>2010-05-30 17:53:09 +0000</bug_when>
    <thetext>Resolution DOWNSTREAM? Wait a minute...

First of all, it&apos;s a 100% reproducible crash that was obtained by using scripts only. The main point of all this scripting thing is the high level of security. No matter what you write in your scripts, the background layer should NEVER ever ever crash! The good thing is additional leak protection and check for infinite loops, however, it&apos;s not so important as crash-free bindings. As far as I see, this crash haven&apos;t been fixed yet.

Secondly, you&apos;re wrong that something is holding service objects intentionally. Please, consider the given code a little bit closely. Who is actually holding these objects? Is it the data engine? No, because (in the initial version) it creates objects and returns them without any caching. Is it the plasmoid? No, it always calls serviceForSource, stores service object as local variable in a function and totally forget it after service.startOperationCall. We can&apos;t destroy an object in Javascript as in C++ language, however, reference count should be = 0. Don&apos;t write &quot;fix the plasmoid&quot; without giving an idea how to fix it, please!

I know it&apos;s a complicated bug, but we, KDE people, must fearlessly face it and finally solve it ;).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>973321</commentid>
    <comment_count>10</comment_count>
    <who name="Aaron J. Seigo">aseigo</who>
    <bug_when>2010-06-05 00:01:34 +0000</bug_when>
    <thetext>&quot;The good thing is additional leak protection and check for
infinite loops, however, it&apos;s not so important as crash-free bindings&quot;

that&apos;s precisely what this bug was: lack of accounting for leak protection and infinite loops. that&apos;s something QtScript is supposed to be giving us in future releases (hopefully sooner rather that later).

in 4.5 a temporary file is no longer used for services, so the file handle exhaustion won&apos;t happen anymore.

still, if you allocate infinite amounts of memory in your plasmoid we still don&apos;t catch that, and can&apos;t right now (against, blocking on QtScript). fix the script in the meantime because your users won&apos;t like it being terminated either.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>42889</attachid>
            <date>2010-04-19 11:01:51 +0000</date>
            <delta_ts>2010-04-19 11:01:51 +0000</delta_ts>
            <desc>plasmoid that&apos;s crashed</desc>
            <filename>plasmoid-testcase.tar.bz2</filename>
            <type>application/x-bzip2</type>
            <size>1883</size>
            <attacher name="Nikita Melnichenko">open-development</attacher>
            
              <data encoding="base64">QlpoOTFBWSZTWaremR8ABrt/hci4AQB4////f7//yv////oAAgAgAAhgB4+V2u3DNg1Q11oCgA6N
BJIIU9NNNKemap4o/QTKaD1AZNNBoeo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