Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[SOLVED] QQmlComponent constructor hangs on pthread_cond_wait
mjmvisser last edited by
Can someone else build qtdeclarative/examples/qml/referenceexamples/attached in qt5 git master and see if you can run it?
It hangs for me, maybe a race condition? Here's a stack trace:
@#0 0x000000356320b3dc in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x00007ffff6970c6f in QWaitConditionPrivate::wait (this=0x624db0, time=18446744073709551615) at thread/qwaitcondition_unix.cpp:86
#2 0x00007ffff69709f1 in QWaitCondition::wait (this=0x623c68, mutex=0x623c60, time=18446744073709551615) at thread/qwaitcondition_unix.cpp:158
#3 0x00007ffff7c7576a in QQmlThreadPrivate::wait (this=0x623bf0) at qml/ftw/qqmlthread.cpp:64
#4 0x00007ffff7c753f5 in QQmlThread::internalCallMethodInThread (this=0x623bc0, message=0x66f960) at qml/ftw/qqmlthread.cpp:311
#5 0x00007ffff7beba30 in QQmlThread::callMethodInThread<QQmlDataBlob*, QQmlDataBlob*, QQmlDataLoaderThread> (this=0x623bc0, Member=
(void (QQmlDataLoaderThread::*)(QQmlDataLoaderThread *, QQmlDataBlob *)) 0x7ffff7be2280 QQmlDataLoaderThread::loadThread(QQmlDataBlob*), arg=@0x7fffffffa430)
#6 0x00007ffff7be1feb in QQmlDataLoaderThread::load (this=0x623bc0, b=0x66fbd0) at qml/qqmltypeloader.cpp:731
#7 0x00007ffff7be2684 in QQmlDataLoader::load (this=0x624a48, blob=0x66fbd0, mode=QQmlDataLoader::PreferSynchronous) at qml/qqmltypeloader.cpp:899
#8 0x00007ffff7be51e9 in QQmlTypeLoader::getType (this=0x624a48, url=..., mode=QQmlDataLoader::PreferSynchronous) at qml/qqmltypeloader.cpp:1474
#9 0x00007ffff7b92794 in QQmlComponentPrivate::loadUrl (this=0x66f630, newUrl=..., mode=QQmlComponent::PreferSynchronous) at qml/qqmlcomponent.cpp:681
#10 0x00007ffff7b91f6b in QQmlComponent::QQmlComponent (this=0x7fffffffa650, engine=0x7fffffffa660, url=..., parent=0x0) at qml/qqmlcomponent.cpp:521
#11 0x0000000000404d95 in main (argc=1, argv=0x7fffffffa968) at main.cpp:59@
What's weird is that tests run fine (using QUICK_TEST_MAIN).
This happens with the latest qt5 in git, built with qt5_tool -u -c -b. (edit: CentOS 6.2)
Ok, I tried using Asynchronous compilation mode. The result is the same, but now the constructor completes, isLoading() is true, but the statusChanged signal is never emitted.
-It appears that QQmlDataLoader::m_thread (instance of QQmlDataLoaderThread) is not running -- at least QQmlDataLoaderThread::loadThread is not called, as far as I can tell. Weird. Still investigating.-
The thread is running, an event is posted via QQmlDataLoaderThread::callMethodInThread, but QQmlThreadPrivate::event doesn't get called. I'm going to rebuild with -no-glib to rule out some kind of compatibility problem (had to build my own at-spi2 and glib, CentOS 6.2's are too old).
Looks like it was a glib problem after all; rebuilding Qt with -no-glib seems to have solved it. In case anyone else hits this problem, it seems that glib-2.34.0 was causing the problem.