Details
-
Bug
-
Resolution: Unresolved
-
P1: Critical
-
None
-
5.14.2, 5.15.0
-
None
-
Ubuntu 20.04, Ubuntu 18.04
Description
Main thread gets blocked during Qt3D initialization if I have a thread from the global thread pool started using QtConcurrent::run. It doesn't happen if I use separate thread pool.
Can be reproduced with any qml qt3d example, for example simple-qml. The same code works fine with Qt 5.12.4
#include <Qt3DQuickExtras/qt3dquickwindow.h> #include <QGuiApplication> #include <QtConcurrent> int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); Qt3DExtras::Quick::Qt3DQuickWindow view; view.setSource(QUrl("qrc:/main.qml")); //works fine QThreadPool p; QtConcurrent::run(&p,[](){while(true){QThread::sleep(1);qDebug()<<"Thread 1";}}); //Causes main thread lock QtConcurrent::run([](){while(true){QThread::sleep(1);qDebug()<<"Thread 2";}}); view.show(); return app.exec(); }
1 futex_wait_cancelable futex-internal.h 183 0x7ffff400c376
2 __pthread_cond_wait_common pthread_cond_wait.c 508 0x7ffff400c376
3 __pthread_cond_wait pthread_cond_wait.c 638 0x7ffff400c376
4 QWaitCondition::wait(QMutex *, QDeadlineTimer) 0x7ffff66ccd23
5 QFutureInterfaceBase::waitForFinished() 0x7ffff66ce8de
6 Qt3DCore::QAspectJobManager::waitForPerThreadFunction(void ( *)(void *), void *) 0x7ffff51ec94f
7 Qt3DCore::QAspectManager::initialize() 0x7ffff51e52aa
8 Qt3DCore::QAspectEnginePrivate::initialize() 0x7ffff51e0643
9 Qt3DCore::QAspectEngine::setRootEntity(QSharedPointer<Qt3DCore::QEntity>) 0x7ffff51e2535
10 Qt3DCore::Quick::QQmlAspectEnginePrivate::_q_continueExecute() 0x7ffff5ac037f
11 Qt3DCore::Quick::QQmlAspectEngine::setSource(QUrl const&) 0x7ffff5ac0518
12 Qt3DExtras::Quick::Qt3DQuickWindow::showEvent(QShowEvent *) 0x7ffff7dc1769
13 QWindow::event(QEvent *) 0x7ffff75fcdcb
14 QCoreApplication::notifyInternal2(QObject *, QEvent *) 0x7ffff68ad8f8
15 QWindowPrivate::setVisible(bool) 0x7ffff75fcad8
16 main main.cpp 67 0x555555556b4d