Details
Description
Discovered by our unittest framework, which repeatedly creates and destroys engines in sequence in the main thread. The error seems to be timing based, a race condition of some kind, and we can only reproduce it when we run this test executable concurrently with other (unrelated) QTest test executables. This seems to be a regression in Qt 6.5.6. It was discovered when updating from 6.5.3 to 6.5.6.
Our eyes were on "7318fadc42" which seems related, but reverting this didn't fix the error.
thread 1:
#0 __futex_abstimed_wait_common64 (private=0, cancel=true, abstime=0x0, op=393, expected=0, futex_word=0x55e10c0f7e40) at futex-internal.c:57 #1 __futex_abstimed_wait_common (futex_word=futex_word@entry=0x55e10c0f7e40, expected=expected@entry=0, clockid=clockid@entry=0, abstime=abstime@entry=0x0, private=private@entry=0, cancel=cancel@entry=true) at futex-internal.c:87 #2 0x00007ff3ce68684f in __GI___futex_abstimed_wait_cancelable64 (futex_word=futex_word@entry=0x55e10c0f7e40, expected=expected@entry=0, clockid=clockid@entry=0, abstime=abstime@entry=0x0, private=private@entry=0) at futex-internal.c:139 #3 0x00007ff3ce688ff0 in __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x55e10c0f7df0, cond=0x55e10c0f7e18) at pthread_cond_wait.c:504 #4 ___pthread_cond_wait (cond=0x55e10c0f7e18, mutex=0x55e10c0f7df0) at pthread_cond_wait.c:619 #5 0x00007ff3cf0e2dfb in QWaitCondition::wait(QMutex*, QDeadlineTimer) () from <path>lib/libQt6Core.so.6 #6 0x00007ff3cf0da711 in QThread::wait(QDeadlineTimer) () from <path>lib/libQt6Core.so.6 #7 0x00007ff3d36c3dff in QQmlThread::shutdown() () from <path>lib/libQt6Qml.so.6 #8 0x00007ff3d37ed68d in QQmlTypeLoader::invalidate() () from <path>lib/libQt6Qml.so.6 #9 0x00007ff3d37083a6 in QQmlEngine::~QQmlEngine() () from <path>lib/libQt6Qml.so.6 #10 0x000055e10ad2c7f3 in roomos::core::tests::unittests::tst_AppItemManager::deinitWhileLoading() () #11 0x00007ff3cef56d50 in QMetaMethodInvoker::invokeImpl(QMetaMethod, void*, Qt::ConnectionType, long long, void const* const*, char const* const*, QtPrivate::QMetaTypeInterface const* const*) () from <path>lib/libQt6Core.so.6 #12 0x00007ff3cef57cdd in QMetaMethod::invokeImpl(QMetaMethod, void*, Qt::ConnectionType, long long, void const* const*, char const* const*, QtPrivate::QMetaTypeInterface const* const*) () from <path>lib/libQt6Core.so.6 #13 0x00007ff3d6333892 in QTest::TestMethods::invokeTestOnData(int) const () from <path>lib/libQt6Test.so.6 #14 0x00007ff3d63346cc in QTest::TestMethods::invokeTest(int, QLatin1String, QTest::WatchDog*) const () from <path>lib/libQt6Test.so.6 #15 0x00007ff3d6334d20 in QTest::TestMethods::invokeTests(QObject*) const () from <path>lib/libQt6Test.so.6 #16 0x00007ff3d633552f in QTest::qRun() () from <path>lib/libQt6Test.so.6 #17 0x00007ff3d633599c in QTest::qExec(QObject*, int, char**) () from <path>lib/libQt6Test.so.6 #18 0x000055e10ad16436 in main ()
thread 2:
#0 0x00007fbee5e867ea in __futex_abstimed_wait_common () from /lib64/libc.so.6 #1 0x00007fbee5e88ff0 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libc.so.6 #2 0x00007fbee68e2dfb in QWaitCondition::wait(QMutex*, QDeadlineTimer) () from <path>lib/libQt6Core.so.6 #3 0x00007fbeeaec3983 in QQmlThread::internalCallMethodInMain(QQmlThread::Message*) () from <path>lib/libQt6Qml.so.6 #4 0x00007fbeeaf8235d in QQmlPluginImporter::finalizePlugin(QObject*, QString const&) () from <path>lib/libQt6Qml.so.6 #5 0x00007fbeeaf82a37 in QQmlPluginImporter::importDynamicPlugin(QString const&, QString const&, bool) () from <path>lib/libQt6Qml.so.6 #6 0x00007fbeeaf83dd4 in QQmlPluginImporter::importPlugins() () from <path>lib/libQt6Qml.so.6 #7 0x00007fbeeaf2d31e in QQmlImports::importExtension(QString const&, QTypeRevision, QQmlImportDatabase*, QQmlTypeLoaderQmldirContent const*, QList<QQmlError>*) () from <path>lib/libQt6Qml.so.6 #8 0x00007fbeeaf334da in QQmlImports::addLibraryImport(QQmlImportDatabase*, QString const&, QString const&, QTypeRevision, QString const&, QString const&, QFlags<QQmlImports::ImportFlag>, unsigned short, QList<QQmlError>*) () from <path>lib/libQt6Qml.so.6 #9 0x00007fbeeaff5850 in QQmlTypeLoader::Blob::addLibraryImport(std::shared_ptr<QQmlTypeLoader::Blob::PendingImport> const&, QList<QQmlError>*) () from <path>lib/libQt6Qml.so.6 #10 0x00007fbeeaff63b5 in QQmlTypeLoader::Blob::loadDependentImports(QList<QQmlDirParser::Import> const&, QString const&, QTypeRevision, unsigned short, QFlags<QQmlImports::ImportFlag>, QList<QQmlError>*) () from <path>lib/libQt6Qml.so.6 #11 0x00007fbeeaff3e9d in QQmlTypeLoader::Blob::loadImportDependencies(std::shared_ptr<QQmlTypeLoader::Blob::PendingImport> const&, QString const&, QFlags<QQmlImports::ImportFlag>, QList<QQmlError>*) () from <path>lib/libQt6Qml.so.6 #12 0x00007fbeeaff5887 in QQmlTypeLoader::Blob::addLibraryImport(std::shared_ptr<QQmlTypeLoader::Blob::PendingImport> const&, QList<QQmlError>*) () from <path>lib/libQt6Qml.so.6 #13 0x00007fbeeaff63b5 in QQmlTypeLoader::Blob::loadDependentImports(QList<QQmlDirParser::Import> const&, QString const&, QTypeRevision, unsigned short, QFlags<QQmlImports::ImportFlag>, QList<QQmlError>*) () from <path>lib/libQt6Qml.so.6 #14 0x00007fbeeaff3e9d in QQmlTypeLoader::Blob::loadImportDependencies(std::shared_ptr<QQmlTypeLoader::Blob::PendingImport> const&, QString const&, QFlags<QQmlImports::ImportFlag>, QList<QQmlError>*) () from <path>lib/libQt6Qml.so.6 #15 0x00007fbeeaff5887 in QQmlTypeLoader::Blob::addLibraryImport(std::shared_ptr<QQmlTypeLoader::Blob::PendingImport> const&, QList<QQmlError>*) () from <path>lib/libQt6Qml.so.6 #16 0x00007fbeeaff6217 in QQmlTypeLoader::Blob::addImport(QV4::CompiledData::Import const*, QFlags<QQmlImports::ImportFlag>, QList<QQmlError>*) () from <path>lib/libQt6Qml.so.6 #17 0x00007fbeeafda76a in QQmlTypeData::tryLoadFromDiskCache() () from <path>lib/libQt6Qml.so.6 #18 0x00007fbeeafdffbf in QQmlTypeData::dataReceived(QQmlDataBlob::SourceCodeData const&) () from <path>lib/libQt6Qml.so.6 #19 0x00007fbeeafef927 in QQmlTypeLoader::setData(QQmlRefPointer<QQmlDataBlob> const&, QQmlDataBlob::SourceCodeData const&) () from <path>lib/libQt6Qml.so.6 #20 0x00007fbeeafefc93 in QQmlTypeLoader::setData(QQmlRefPointer<QQmlDataBlob> const&, QString const&) () from <path>lib/libQt6Qml.so.6 #21 0x00007fbeeaff1e8f in QQmlTypeLoader::loadThread(QQmlRefPointer<QQmlDataBlob> const&) () from <path>lib/libQt6Qml.so.6 #22 0x00007fbeeaffebd7 in QQmlThread::createMessageFromMethod<void (QQmlTypeLoaderThread::*)(QQmlRefPointer<QQmlDataBlob> const&), QQmlRefPointer<QQmlDataBlob> const&>(void (QQmlTypeLoaderThread::*&&)(QQmlRefPointer<QQmlDataBlob> const&), QQmlRefPointer<QQmlDataBlob> const&)::I::call(QQmlThread*) () from <path>lib/libQt6Qml.so.6 #23 0x00007fbeeaec3520 in QQmlThreadPrivate::threadEvent() () from <path>lib/libQt6Qml.so.6 #24 0x00007fbeeaec3eb2 in QQmlThreadPrivate::event(QEvent*) () from <path>lib/libQt6Qml.so.6 #25 0x00007fbee674356a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from <path>lib/libQt6Core.so.6 #26 0x00007fbee6746760 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from <path>lib/libQt6Core.so.6 #27 0x00007fbee68d5b3a in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from <path>lib/libQt6Core.so.6 #28 0x00007fbee674edeb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from <path>lib/libQt6Core.so.6 #29 0x00007fbee685a3dc in QThread::exec() () from <path>lib/libQt6Core.so.6 #30 0x00007fbee68da9ff in QThreadPrivate::start(void*) () from <path>lib/libQt6Core.so.6 #31 0x00007fbee5e89c52 in start_thread () from /lib64/libc.so.6 #32 0x00007fbee5f0ec80 in clone3 () from /lib64/libc.so.6
The deinitWhileLoading function creates a QQmlEngine, then runs through test code that uses QQmlComponent to create several items that run several tests, then destroys them, and finally the function ends. The hang comes when QQmlEngine falls out of scope. I am happy to help debugging on my end, but the test code can't be shared unfortunately...
Attachments
Issue Links
- resulted from
-
QTBUG-122925 QQmlComponentPrivate::doBeginCreate can crash in some scenarios
- Closed