[Kde-hardware-devel] Review Request: resolve deadlock on app exit in fstab backend

Aaron Seigo aseigo at kde.org
Tue Aug 31 03:08:18 CEST 2010


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/5193/
-----------------------------------------------------------

Review request for Solid.


Summary
-------

we'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=<value optimized out>) at /home/aseigo/kde4/qt/src/corelib/io/qfilesystemwatcher.cpp:440
#6  0xb60049ad in QFileSystemWatcher::~QFileSystemWatcher (this=0x8411200, 
    __in_chrg=<value optimized out>) 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=<value optimized out>)
    at /home/aseigo/kde4/qt/src/corelib/kernel/qobject.cpp:945
#9  0xb4e883ea in Solid::Ifaces::DeviceManager::~DeviceManager (this=0x83c1618, 
    __in_chrg=<value optimized out>)
    at /home/aseigo/kde4/KDE/kdelibs/solid/solid/ifaces/devicemanager.cpp:29
#10 0xb4ece7a1 in Solid::Backends::Fstab::FstabManager::~FstabManager (this=0x83c1618, 
    __in_chrg=<value optimized out>)
    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=<value optimized out>)
    at /home/aseigo/kde4/KDE/kdelibs/solid/solid/backends/fstab/fstabmanager.cpp:134
#12 0xb4e70430 in qDeleteAll<QList<QObject*>::const_iterator> (begin=..., end=...)
    at /home/aseigo/kde4/qt-copy/include/QtCore/qalgorithms.h:322
#13 0xb4e702d9 in qDeleteAll<QList<QObject*> > (c=...)
    at /home/aseigo/kde4/qt-copy/include/QtCore/qalgorithms.h:330
#14 0xb4e6fe8d in Solid::ManagerBasePrivate::~ManagerBasePrivate (this=0x8416c58, 
    __in_chrg=<value optimized out>) at /home/aseigo/kde4/KDE/kdelibs/solid/solid/managerbase.cpp:47
#15 0xb4e72f72 in Solid::DeviceManagerPrivate::~DeviceManagerPrivate (this=0x8416c50, 
    __in_chrg=<value optimized out>) at /home/aseigo/kde4/KDE/kdelibs/solid/solid/devicemanager.cpp:48
#16 0xb4e72fc1 in Solid::DeviceManagerPrivate::~DeviceManagerPrivate (this=0x8416c50, 
    __in_chrg=<value optimized out>) at /home/aseigo/kde4/KDE/kdelibs/solid/solid/devicemanager.cpp:62
#17 0xb4e763f2 in QThreadStorage<Solid::DeviceManagerPrivate*>::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=<value optimized out>)
    at /home/aseigo/kde4/qt/src/corelib/kernel/qcoreapplication.cpp:291
#20 0xb53a446b in QApplicationPrivate::~QApplicationPrivate (this=0x8079940, 

it'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 "pretty", does the job.


Diffs
-----

  /trunk/KDE/kdelibs/solid/solid/backends/fstab/fstabmanager.h 1170183 
  /trunk/KDE/kdelibs/solid/solid/backends/fstab/fstabmanager.cpp 1170183 

Diff: http://reviewboard.kde.org/r/5193/diff


Testing
-------

run plasma-desktop, try kquitapp plasma-desktop and ensure it exits cleanly.


Thanks,

Aaron

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/kde-hardware-devel/attachments/20100831/fe1924d3/attachment.htm 


More information about the Kde-hardware-devel mailing list