Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.3.0, 5.4.0, 5.5.0, 5.6.0 Alpha
-
None
-
Ubuntu 12.04
dbus version 1.4.18 (also reproduces on dbus 1.6.4)
Description
A Qt based application hangs when handling a signal received from DBus on the main thread, while simultaneously trying to connect to a DBus signal on another thread.
Thread 1 - main thread - handling the signal received from DBus: 0 pthread_cond_wait@@GLIBC_2.3.2 pthread_cond_wait.S 162 0x7ffff672fd84 1 QWaitConditionPrivate::wait qwaitcondition_unix.cpp 136 0x7ffff72e7573 2 QWaitCondition::wait qwaitcondition_unix.cpp 208 0x7ffff72e733b 3 QReadWriteLock::lockForRead qreadwritelock.cpp 155 0x7ffff72db316 4 QDBusReadLocker::QDBusReadLocker qdbusthreaddebug_p.h 141 0x7ffff7b43909 5 QDBusConnectionPrivate::handleSignal qdbusintegrator.cpp 1651 0x7ffff7b51ae3 6 QDBusConnectionPrivate::handleMessage qdbusintegrator.cpp 567 0x7ffff7b4c29e 7 qDBusSignalFilter qdbusintegrator.cpp 548 0x7ffff7b4c12d 8 dbus_connection_dispatch /lib/x86_64-linux-gnu/libdbus-1.so.3 0x7ffff5260ad6 9 q_dbus_connection_dispatch qdbus_symbols_p.h 188 0x7ffff7b495f1 10 QDBusConnectionPrivate::doDispatch qdbusintegrator.cpp 1180 0x7ffff7b4ecee 11 QDBusConnectionPrivate::socketRead qdbusintegrator.cpp 1195 0x7ffff7b4ee70 12 QDBusConnectionPrivate::qt_static_metacall moc_qdbusconnection_p.cpp 131 0x7ffff7ba1a46 13 QMetaObject::activate qobject.cpp 3723 0x7ffff7557cf1 14 QMetaObject::activate qobject.cpp 3588 0x7ffff75575f2 15 QSocketNotifier::activated moc_qsocketnotifier.cpp 134 0x7ffff7601174 16 QSocketNotifier::event qsocketnotifier.cpp 296 0x7ffff7563da0 17 QCoreApplicationPrivate::notify_helper qcoreapplication.cpp 1136 0x7ffff7515e04 18 doNotify qcoreapplication.cpp 1077 0x7ffff7515a97 19 QCoreApplication::notify qcoreapplication.cpp 1063 0x7ffff7515a0a 20 QCoreApplication::notifyInternal2 qcoreapplication.cpp 1002 0x7ffff751599c 21 QCoreApplication::sendEvent qcoreapplication.h 227 0x7ffff7519a80 22 socketNotifierSourceDispatch qeventdispatcher_glib.cpp 100 0x7ffff75906a2 23 g_main_context_dispatch /lib/x86_64-linux-gnu/libglib-2.0.so.0 0x7ffff5e53d13 24 ?? /lib/x86_64-linux-gnu/libglib-2.0.so.0 0x7ffff5e54060 25 g_main_context_iteration /lib/x86_64-linux-gnu/libglib-2.0.so.0 0x7ffff5e54124 26 QEventDispatcherGlib::processEvents qeventdispatcher_glib.cpp 417 0x7ffff7591379 27 QEventLoop::processEvents qeventloop.cpp 128 0x7ffff7512128 28 QEventLoop::exec qeventloop.cpp 204 0x7ffff7512401 29 QCoreApplication::exec qcoreapplication.cpp 1272 0x7ffff75160d9 30 main main.cpp 55 0x402087 Thread 2 - trying to connect to a DBus signal: 0 syscall syscall.S 39 0x7ffff6a305a9 1 _q_futex qmutex_linux.cpp 146 0x7ffff72da6f9 2 lockInternal_helper<false> qmutex_linux.cpp 187 0x7ffff72da8e4 3 QBasicMutex::lockInternal qmutex_linux.cpp 203 0x7ffff72da755 4 QBasicMutex::lock qmutex.h 59 0x7ffff72dab41 5 QRecursiveMutexPrivate::lock qmutex.cpp 641 0x7ffff72dad78 6 QMutex::lock qmutex.cpp 215 0x7ffff72da506 7 QDBusMutexLocker::QDBusMutexLocker qdbusthreaddebug_p.h 183 0x7ffff7b58c0e 8 QDBusDispatchLocker::QDBusDispatchLocker qdbusthreaddebug_p.h 198 0x7ffff7b58caa 9 QDBusConnectionPrivate::sendWithReply qdbusintegrator.cpp 2049 0x7ffff7b539cb 10 QDBusConnectionPrivate::getNameOwnerNoCache qdbusintegrator.cpp 2507 0x7ffff7b56858 11 QDBusConnectionPrivate::connectSignal qdbusintegrator.cpp 2283 0x7ffff7b55523 12 QDBusConnectionPrivate::connectSignal qdbusintegrator.cpp 2250 0x7ffff7b550ef 13 QDBusConnection::connect qdbusconnection.cpp 692 0x7ffff7b41a64 14 QDBusConnection::connect qdbusconnection.cpp 613 0x7ffff7b4168d 15 ConnectToSignalThread::timerEvent connecttosignalthread.cpp 25 0x40309e 16 QObject::event qobject.cpp 1230 0x7ffff7550f4a 17 QThread::event qthread.cpp 810 0x7ffff72de756 18 QCoreApplicationPrivate::notify_helper qcoreapplication.cpp 1136 0x7ffff7515e04 19 doNotify qcoreapplication.cpp 1077 0x7ffff7515a97 20 QCoreApplication::notify qcoreapplication.cpp 1063 0x7ffff7515a0a 21 QCoreApplication::notifyInternal2 qcoreapplication.cpp 1002 0x7ffff751599c 22 QCoreApplication::sendEvent qcoreapplication.h 227 0x7ffff7519a80 23 QTimerInfoList::activateTimers qtimerinfo_unix.cpp 637 0x7ffff758f69c 24 timerSourceDispatch qeventdispatcher_glib.cpp 176 0x7ffff759099d 25 g_main_context_dispatch /lib/x86_64-linux-gnu/libglib-2.0.so.0 0x7ffff5e53d13 26 ?? /lib/x86_64-linux-gnu/libglib-2.0.so.0 0x7ffff5e54060 27 g_main_context_iteration /lib/x86_64-linux-gnu/libglib-2.0.so.0 0x7ffff5e54124 28 QEventDispatcherGlib::processEvents qeventdispatcher_glib.cpp 419 0x7ffff7591399 29 QEventLoop::processEvents qeventloop.cpp 128 0x7ffff7512128 30 QEventLoop::exec qeventloop.cpp 204 0x7ffff7512401 31 QThread::exec qthread.cpp 503 0x7ffff72de2dc 32 ConnectToSignalThread::run connecttosignalthread.cpp 19 0x402fec 33 QThreadPrivate::start qthread_unix.cpp 332 0x7ffff72e5e34 34 start_thread pthread_create.c 308 0x7ffff672be9a 35 clone clone.S 112 0x7ffff6a3438d 36 ?? Thread 1: frame 10 -> acquired QDBusConnectionPrivate::dispatchLock frame 5 -> trying to acquire QDBusConnectionPrivate::lock - for read Thread 2: frame 13 -> acquired QDBusConnectionPrivate::lock - for write frame 9 -> trying to acquire QDBusConnectionPrivate::dispatchLock
Attached test application: run the servers in any order, then start the Client -> after some time, the output of the Client is stopped (hang).
Note: this problem reproduces all the way down to 5.3 where a fix for QTBUG-42189 was provided (merged locks).