Bug 199226

Summary: Plasma crash (QGraphicsItemPrivate::updateCachedClipPathFromSetPosHelper, QGraphicsItemPrivate::setPosHelper)
Product: [Unmaintained] plasma4 Reporter: Travis McHenry <wordsizzle>
Component: generalAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: crash CC: andresbajotierra, aseigo, darktears31, deblauwetom, kde, sputnikshock, user581
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Unlisted Binaries   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Travis McHenry 2009-07-07 02:50:06 UTC
Application that crashed: plasma-desktop
Version of the application: 0.3
KDE Version: 4.2.95 (KDE 4.2.95 (KDE 4.3 RC1))
Qt Version: 4.5.1
Operating System: Linux 2.6.28-13-generic i686
Distribution: Ubuntu 9.04

What I was doing when the application crashed:
Plasma tends to leak memory for me (I believe most of the blame can be placed on plasmoids although i have yet to find the time to track it down to which plasmoids to file a report, i'll get on that when i can) so I restart plasma every few days with kquitapp plasma-desktop, followed by running plasma-desktop again. On doing this with kde4.3rc1 (not sure if kubuntu is using the actual rc1?) it crashed mid-startup with the included backtrace.

 -- Backtrace:
Application: Plasma Workspace (plasma-desktop), signal: Segmentation fault
[Current thread is 0 (LWP 3184)]

Thread 4 (Thread 0xa8239b90 (LWP 3185)):
#0  0xb7fdc430 in __kernel_vsyscall ()
#1  0xb50b30e5 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/i686/cmov/libpthread.so.0
#2  0xb63032ed in pthread_cond_wait () from /lib/tls/i686/cmov/libc.so.6
#3  0xb64e75b2 in QWaitCondition::wait (this=0x96b2f50, mutex=0x96b2f4c, time=4294967295) at thread/qwaitcondition_unix.cpp:87
#4  0xb794bae2 in QHostInfoAgent::run (this=0x96b2f40) at kernel/qhostinfo.cpp:260
#5  0xb64e656e in QThreadPrivate::start (arg=0x96b2f40) at thread/qthread_unix.cpp:189
#6  0xb50af4ff in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#7  0xb62f449e in clone () from /lib/tls/i686/cmov/libc.so.6

Thread 3 (Thread 0xa2225b90 (LWP 3195)):
#0  0xb7fdc430 in __kernel_vsyscall ()
#1  0xb50b3412 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/tls/i686/cmov/libpthread.so.0
#2  0xb6303344 in pthread_cond_timedwait () from /lib/tls/i686/cmov/libc.so.6
#3  0xb64e758c in QWaitCondition::wait (this=0xa361378, mutex=0xa361374, time=30000) at thread/qwaitcondition_unix.cpp:85
#4  0xb64dcac6 in QThreadPoolThread::run (this=0x964f6d8) at concurrent/qthreadpool.cpp:140
#5  0xb64e656e in QThreadPrivate::start (arg=0x964f6d8) at thread/qthread_unix.cpp:189
#6  0xb50af4ff in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#7  0xb62f449e in clone () from /lib/tls/i686/cmov/libc.so.6

Thread 2 (Thread 0xa1a24b90 (LWP 3196)):
#0  0xb7fdc430 in __kernel_vsyscall ()
#1  0xb50b3412 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/tls/i686/cmov/libpthread.so.0
#2  0xb6303344 in pthread_cond_timedwait () from /lib/tls/i686/cmov/libc.so.6
#3  0xb64e758c in QWaitCondition::wait (this=0xa361378, mutex=0xa361374, time=30000) at thread/qwaitcondition_unix.cpp:85
#4  0xb64dcac6 in QThreadPoolThread::run (this=0xa35f538) at concurrent/qthreadpool.cpp:140
#5  0xb64e656e in QThreadPrivate::start (arg=0xa35f538) at thread/qthread_unix.cpp:189
#6  0xb50af4ff in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#7  0xb62f449e in clone () from /lib/tls/i686/cmov/libc.so.6

Thread 1 (Thread 0xb3cde730 (LWP 3184)):
[KCrash Handler]
#5  QGraphicsItemPrivate::updateCachedClipPathFromSetPosHelper (this=0xa86aa80, newPos=@0xbfcf7630) at graphicsview/qgraphicsitem.cpp:3891
#6  0xb6ea41a5 in QGraphicsItemPrivate::setPosHelper (this=0xa86aa80, pos=@0xbfcf7790) at graphicsview/qgraphicsitem.cpp:2367
#7  0xb6eeef18 in QGraphicsWidget::setGeometry (this=0xa7bb978, rect=@0xbfcf78b0) at graphicsview/qgraphicswidget.cpp:382
#8  0xb6ef63db in QGridLayoutItem::setGeometry (this=0xa8744d0, rect=@0xbfcf78b0) at graphicsview/qgridlayoutengine.cpp:650
#9  0xb6efc3e2 in QGridLayoutEngine::setGeometries (this=0x925d178, styleInfo=@0xbfcf793c, contentsGeometry=@0xbfcf7918) at graphicsview/qgridlayoutengine.cpp:1030
#10 0xb6eeaa54 in QGraphicsLinearLayout::setGeometry (this=0x9418a80, rect=@0xbfcf7998) at graphicsview/qgraphicslinearlayout.cpp:503
#11 0xb6ee7aef in QGraphicsLayout::activate (this=0x9418a80) at graphicsview/qgraphicslayout.cpp:269
#12 0xb6ee7b6c in QGraphicsLayout::widgetEvent (this=0x9418a80, e=0xa46cf50) at graphicsview/qgraphicslayout.cpp:366
#13 0xb6eee213 in QGraphicsWidget::event (this=0x92a43e0, event=0xa46cf50) at graphicsview/qgraphicswidget.cpp:1262
#14 0xb6865bcc in QApplicationPrivate::notify_helper (this=0x8fa7710, receiver=0x92a43e0, e=0xa46cf50) at kernel/qapplication.cpp:4057
#15 0xb686dede in QApplication::notify (this=0x8f9b480, receiver=0x92a43e0, e=0xa46cf50) at kernel/qapplication.cpp:3604
#16 0xb76ce3dd in KApplication::notify (this=0x8f9b480, receiver=0x92a43e0, event=0xa46cf50) at /build/buildd/kde4libs-4.2.95/kdeui/kernel/kapplication.cpp:302
#17 0xb65da7ab in QCoreApplication::notifyInternal (this=0x8f9b480, receiver=0x92a43e0, event=0xa46cf50) at kernel/qcoreapplication.cpp:610
#18 0xb65db405 in QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x8f85ca0) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:213
#19 0xb65db5fd in QCoreApplication::sendPostedEvents (receiver=0x0, event_type=0) at kernel/qcoreapplication.cpp:1140
#20 0xb660658f in postEventSourceDispatch (s=0x8faa100) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:218
#21 0xb4eadb88 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#22 0xb4eb10eb in ?? () from /usr/lib/libglib-2.0.so.0
#23 0xb4eb1268 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#24 0xb66061d8 in QEventDispatcherGlib::processEvents (this=0x8fa6cf8, flags={i = -1076920456}) at kernel/qeventdispatcher_glib.cpp:324
#25 0xb6907765 in QGuiEventDispatcherGlib::processEvents (this=0x8fa6cf8, flags={i = -1076920408}) at kernel/qguieventdispatcher_glib.cpp:202
#26 0xb65d8dda in QEventLoop::processEvents (this=0xbfcf8020, flags={i = -1076920344}) at kernel/qeventloop.cpp:149
#27 0xb65d921a in QEventLoop::exec (this=0xbfcf8020, flags={i = -1076920280}) at kernel/qeventloop.cpp:200
#28 0xb65db6c9 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:888
#29 0xb6865a47 in QApplication::exec () at kernel/qapplication.cpp:3526
#30 0xb7f77510 in kdemain () from /usr/lib/libkdeinit4_plasma-desktop.so
#31 0x08048712 in _start ()

Reported using DrKonqi
Comment 1 Aaron J. Seigo 2009-07-07 02:56:18 UTC
the backtrace never leaves QGrapicsView code, so this is likely an upstream problem.

for the other issue:

* what widgets are you running?
* what wallpaper style do you use? (e.g. slideshow?)
* does it still leak with 4.3rc1?
Comment 2 Travis McHenry 2009-07-07 03:38:50 UTC
So it's Qt's fault? should I send this crash report on over to their bug tracker?

Yes, it does leak with 4.3rc1

Wallpaper Type: Basic image.

Widgets I use:
Folder View
3xClock widgets (used to be 1 and no change when adding 2 so I doubt they're at fault)
Sticky note
openDesktop 
LCD Weather Station
CPU Monitor
Pastebin
Microblog
ScreenSaverSwitch (slightly modified from http://www.kde-look.org/content/show.php/Screen+Saver+Switch?content=93752 ) but there's not much to leak there.
Then the standard panel stuff, application menu, pager, kate session applet, recent devices, systray, task manager, network manager, trash can.

I'm around 90% sure microblog does leak memory, i've used it inside plasmoidviewer and watched the memory grow as dents/tweets come in.

Using a very meagre understanding of the microblog code maybe this excerpt is at fault?: 

//add the newbies
        int newCount = 0;
        uint maxId = m_lastTweet;
        foreach (const QString &id, data.keys()) {
            uint i = id.toUInt();
            if (i > m_lastTweet) {
                newCount++;
                QVariant v = data.value(id);
                //Warning: This function is not available with MSVC 6
                Plasma::DataEngine::Data t = v.value<Plasma::DataEngine::Data>();
                m_tweetMap[i] = t;
                if (i > maxId) {
                    maxId = i;
                }
            }
        }
        m_lastTweet = maxId;
        m_newTweets = qMin(newCount, m_historySize);
        m_flash->flash( i18np( "1 new tweet", "%1 new tweets", m_newTweets ), 20*1000 );
        showTweets();
///////

It's kinda hard for me to follow but it appears to just keep increasing the size of m_tweetMap. Seems a waste to let it increase past the m_historySize at all since it's refreshed on saveSettings. 

This might be completely misinformed, but this seems like the thing to do:
while(m_tweetMap.size() >= m_historySize) m_tweetMap.remove(m_tweetMap.keys().first()); 
m_tweetMap[i] = t

Seems off, but you get the idea.

It's also important to note that I'm probably an extreme use case here, I leave my computer on pretty much 24/7 restarting only for kernel and other major updates (such as kde4.3rc1) So it took 4 days for memory to get to ~350mb/~350mb(swap) from ~50mb.

Thanks for your time. :)
Travis.
Comment 3 Aaron J. Seigo 2009-07-07 07:58:07 UTC
SVN commit 992497 by aseigo:

don't continue to add to the tweet map. not technically a memory _leak_, but certainly a memory growth. *sigh* this widget has had a very spotty time with memory management. 

thanks to Travis McHenry for doing the investigation

CCBUG:199226


 M  +8 -4      microblog.cpp  
 M  +3 -3      microblog.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=992497
Comment 4 Dario Andres 2009-07-17 22:30:45 UTC
*** Bug 197067 has been marked as a duplicate of this bug. ***
Comment 5 Dario Andres 2009-07-17 22:30:53 UTC
*** Bug 200563 has been marked as a duplicate of this bug. ***
Comment 6 Dario Andres 2009-07-19 19:48:09 UTC
*** Bug 200770 has been marked as a duplicate of this bug. ***
Comment 7 Dario Andres 2009-07-19 19:48:34 UTC
Bug 200770 is another report related to the openSocial widget.
Comment 8 Beat Wolf 2009-12-21 12:04:12 UTC
*** Bug 199896 has been marked as a duplicate of this bug. ***