<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
    <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="http://reviewboard.kde.org/r/5193/">http://reviewboard.kde.org/r/5193/</a>
     </td>
    </tr>
   </table>
   <br />


<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('http://reviewboard.kde.orgrb/images/review_request_box_top_bg.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
 <tr>
  <td>

<div>Review request for Solid.</div>
<div>By Aaron Seigo.</div>





<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">we&#39;re seeing this hang on Solid-using apps on application exit:

#0  0xffffe424 in __kernel_vsyscall ()
#1  0xb5e9b125 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#2  0xb5f28f69 in QWaitConditionPrivate::wait (this=0x84116d8, time=4294967295)
    at /home/aseigo/kde4/qt/src/corelib/thread/qwaitcondition_unix.cpp:88
#3  0xb5f28d6d in QWaitCondition::wait (this=0x8428190, mutex=0x8428178, time=4294967295)
    at /home/aseigo/kde4/qt/src/corelib/thread/qwaitcondition_unix.cpp:160
#4  0xb5f2864e in QThread::wait (this=0x83bfac8, time=4294967295)
    at /home/aseigo/kde4/qt/src/corelib/thread/qthread_unix.cpp:660
#5  0xb6004859 in QFileSystemWatcher::~QFileSystemWatcher (this=0x8411200, 
    __in_chrg=&lt;value optimized out&gt;) at /home/aseigo/kde4/qt/src/corelib/io/qfilesystemwatcher.cpp:440
#6  0xb60049ad in QFileSystemWatcher::~QFileSystemWatcher (this=0x8411200, 
    __in_chrg=&lt;value optimized out&gt;) at /home/aseigo/kde4/qt/src/corelib/io/qfilesystemwatcher.cpp:456
#7  0xb6049478 in QObjectPrivate::deleteChildren (this=0x83c0d70)
    at /home/aseigo/kde4/qt/src/corelib/kernel/qobject.cpp:1949
#8  0xb6047d44 in QObject::~QObject (this=0x83c1618, __in_chrg=&lt;value optimized out&gt;)
    at /home/aseigo/kde4/qt/src/corelib/kernel/qobject.cpp:945
#9  0xb4e883ea in Solid::Ifaces::DeviceManager::~DeviceManager (this=0x83c1618, 
    __in_chrg=&lt;value optimized out&gt;)
    at /home/aseigo/kde4/KDE/kdelibs/solid/solid/ifaces/devicemanager.cpp:29
#10 0xb4ece7a1 in Solid::Backends::Fstab::FstabManager::~FstabManager (this=0x83c1618, 
    __in_chrg=&lt;value optimized out&gt;)
    at /home/aseigo/kde4/KDE/kdelibs/solid/solid/backends/fstab/fstabmanager.cpp:132
#11 0xb4ece7db in Solid::Backends::Fstab::FstabManager::~FstabManager (this=0x83c1618, 
    __in_chrg=&lt;value optimized out&gt;)
    at /home/aseigo/kde4/KDE/kdelibs/solid/solid/backends/fstab/fstabmanager.cpp:134
#12 0xb4e70430 in qDeleteAll&lt;QList&lt;QObject*&gt;::const_iterator&gt; (begin=..., end=...)
    at /home/aseigo/kde4/qt-copy/include/QtCore/qalgorithms.h:322
#13 0xb4e702d9 in qDeleteAll&lt;QList&lt;QObject*&gt; &gt; (c=...)
    at /home/aseigo/kde4/qt-copy/include/QtCore/qalgorithms.h:330
#14 0xb4e6fe8d in Solid::ManagerBasePrivate::~ManagerBasePrivate (this=0x8416c58, 
    __in_chrg=&lt;value optimized out&gt;) at /home/aseigo/kde4/KDE/kdelibs/solid/solid/managerbase.cpp:47
#15 0xb4e72f72 in Solid::DeviceManagerPrivate::~DeviceManagerPrivate (this=0x8416c50, 
    __in_chrg=&lt;value optimized out&gt;) at /home/aseigo/kde4/KDE/kdelibs/solid/solid/devicemanager.cpp:48
#16 0xb4e72fc1 in Solid::DeviceManagerPrivate::~DeviceManagerPrivate (this=0x8416c50, 
    __in_chrg=&lt;value optimized out&gt;) at /home/aseigo/kde4/KDE/kdelibs/solid/solid/devicemanager.cpp:62
#17 0xb4e763f2 in QThreadStorage&lt;Solid::DeviceManagerPrivate*&gt;::deleteData (x=0x8416c50)
    at /home/aseigo/kde4/qt-copy/include/QtCore/qthreadstorage.h:133
#18 0xb5f26466 in QThreadStorageData::finish (p=0x80528d8)
    at /home/aseigo/kde4/qt/src/corelib/thread/qthreadstorage.cpp:185
#19 0xb6030be6 in QCoreApplicationPrivate::~QCoreApplicationPrivate (this=0x8079940, 
    __in_chrg=&lt;value optimized out&gt;)
    at /home/aseigo/kde4/qt/src/corelib/kernel/qcoreapplication.cpp:291
#20 0xb53a446b in QApplicationPrivate::~QApplicationPrivate (this=0x8079940, 

it&#39;s hanging in a call to QInotifyFileSystemWatcherEngine::wait(), which is actually a call to QThread::wait(). on my laptop, this results in the process not exiting fully, a spike in CPU usage that slowly (over the course of several minutes) comes down to ~1% of the CPU. the spike happens increasingly quickly, and the spin down takes increasingly long as it approaches 0, which is probably a clue. :) 

as can be seen in the backtrace, QThreadStorageData::finish is being called, which results in Solid being destroyed, which results in the QThread-based QFileSystemWatcherEngine going into a wait mode ... deadlock.

this patch, while certainly not &quot;pretty&quot;, does the job.</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">run plasma-desktop, try kquitapp plasma-desktop and ensure it exits cleanly.</pre>
  </td>
 </tr>
</table>




<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>/trunk/KDE/kdelibs/solid/solid/backends/fstab/fstabmanager.h <span style="color: grey">(1170183)</span></li>

 <li>/trunk/KDE/kdelibs/solid/solid/backends/fstab/fstabmanager.cpp <span style="color: grey">(1170183)</span></li>

</ul>

<p><a href="http://reviewboard.kde.org/r/5193/diff/" style="margin-left: 3em;">View Diff</a></p>




  </td>
 </tr>
</table>




  </div>
 </body>
</html>