Details
-
Bug
-
Resolution: Done
-
Not Evaluated
-
5.0.0
-
None
-
qtbase b36a40ac0d17fea0b299630f3e3d4174eb7ce1a9
Ubuntu 10.04 32-bit
Description
If QMetaType::construct is called with a custom type, and the custom type's constructor executes a qRegisterMetaType, that qRegisterMetaType will hang indefinitely. It may be a deadlock attempting to lock a mutex which is already locked by the current thread.
Here is a sample backtrace, taken from tst_qxmlquery, which hangs due to this issue:
QObject::connect: Cannot connect (null)::destroyed() to QHostInfoLookupManager::waitForThreadPoolDone() ********* Start testing of tst_QXmlQuery ********* Config: Using QTest library 5.0.0, Qt 5.0.0 PASS : tst_QXmlQuery::initTestCase() PASS : tst_QXmlQuery::defaultConstructor() PASS : tst_QXmlQuery::copyConstructor() PASS : tst_QXmlQuery::constructorQXmlNamePool() PASS : tst_QXmlQuery::constructorQXmlNamePoolQueryLanguage() PASS : tst_QXmlQuery::constructorQXmlNamePoolWithinQSimpleXmlNodeModel() PASS : tst_QXmlQuery::assignmentOperator() PASS : tst_QXmlQuery::isValid() PASS : tst_QXmlQuery::sequentialExecution() PASS : tst_QXmlQuery::bindVariableQString() PASS : tst_QXmlQuery::bindVariableQStringNoExternalDeclaration() PASS : tst_QXmlQuery::bindVariableQXmlName() PASS : tst_QXmlQuery::bindVariableQXmlNameTriggerWarnings() PASS : tst_QXmlQuery::bindVariableQStringQIODevice() PASS : tst_QXmlQuery::bindVariableQStringQIODeviceWithByteArray() PASS : tst_QXmlQuery::bindVariableQStringQIODeviceWithString() PASS : tst_QXmlQuery::bindVariableQStringQIODeviceWithQFile() PASS : tst_QXmlQuery::bindVariableQXmlNameQIODevice() PASS : tst_QXmlQuery::bindVariableQXmlNameQIODeviceTriggerWarnings() Warning in : The variable paramSelectWithTypeIntBoundWithBindVariableRequired is unused Warning in : The variable paramSelectWithTypeIntBoundWithBindVariableRequired is unused Warning in : The variable paramSelectWithTypeIntBoundWithBindVariableRequired is unused Warning in : The variable paramSelectWithTypeIntBoundWithBindVariableRequired is unused Warning in : The variable paramSelectWithTypeIntBoundWithBindVariableRequired is unused Warning in : The variable paramSelectWithTypeIntBoundWithBindVariableRequired is unused PASS : tst_QXmlQuery::bindVariableXSLTSuccess() PASS : tst_QXmlQuery::bindVariableTemporaryNode() PASS : tst_QXmlQuery::setMessageHandler() PASS : tst_QXmlQuery::messageHandler() PASS : tst_QXmlQuery::evaluateToQAbstractXmlReceiverTriggerWarnings() PASS : tst_QXmlQuery::evaluateToQXmlResultItems() PASS : tst_QXmlQuery::evaluateToQXmlResultItemsTriggerWarnings() PASS : tst_QXmlQuery::evaluateToQXmlResultItemsErrorAtEnd() PASS : tst_QXmlQuery::evaluateToReceiver() PASS : tst_QXmlQuery::evaluateToReceiverOnInvalidQuery() PASS : tst_QXmlQuery::evaluateToQStringTriggerError() PASS : tst_QXmlQuery::evaluateToQString() PASS : tst_QXmlQuery::evaluateToQStringSignature() PASS : tst_QXmlQuery::checkGeneratedBaselines() PASS : tst_QXmlQuery::basicXQueryToQtTypeCheck() PASS : tst_QXmlQuery::basicQtToXQueryTypeCheck() PASS : tst_QXmlQuery::bindNode() PASS : tst_QXmlQuery::relativeBaseURI() PASS : tst_QXmlQuery::emptyBaseURI() PASS : tst_QXmlQuery::roundTripDateWithinQXmlItem() PASS : tst_QXmlQuery::bindingMissing() PASS : tst_QXmlQuery::bindDefaultConstructedItem() PASS : tst_QXmlQuery::bindEmptyNullString() PASS : tst_QXmlQuery::bindEmptyString() PASS : tst_QXmlQuery::rebindVariableSameType() PASS : tst_QXmlQuery::rebindVariableDifferentType() PASS : tst_QXmlQuery::rebindVariableWithNullItem() PASS : tst_QXmlQuery::eraseQXmlItemBinding() PASS : tst_QXmlQuery::eraseDeviceBinding() PASS : tst_QXmlQuery::constCorrectness() PASS : tst_QXmlQuery::objectSize() PASS : tst_QXmlQuery::setUriResolver() PASS : tst_QXmlQuery::uriResolver() PASS : tst_QXmlQuery::messageXML() PASS : tst_QXmlQuery::resultItemsDeallocatedQuery() PASS : tst_QXmlQuery::copyCheckMessageHandler() PASS : tst_QXmlQuery::shadowedVariables() PASS : tst_QXmlQuery::setFocusQXmlItem() PASS : tst_QXmlQuery::setFocusQUrl() PASS : tst_QXmlQuery::setFocusQIODevice() PASS : tst_QXmlQuery::setFocusQIODeviceAvoidVariableClash() PASS : tst_QXmlQuery::setFocusQIODeviceFailure() PASS : tst_QXmlQuery::setFocusQIODeviceTriggerWarnings() PASS : tst_QXmlQuery::setFocusQString() PASS : tst_QXmlQuery::setFocusQStringFailure() PASS : tst_QXmlQuery::setFocusQStringSignature() PASS : tst_QXmlQuery::recompilationWithEvaluateToResultFailing() PASS : tst_QXmlQuery::secondEvaluationWithEvaluateToResultFailing() PASS : tst_QXmlQuery::recompilationWithEvaluateToReceiver() PASS : tst_QXmlQuery::fnDocOnQIODeviceTimeout() PASS : tst_QXmlQuery::evaluateToQStringListOnInvalidQuery() PASS : tst_QXmlQuery::evaluateToQStringList() PASS : tst_QXmlQuery::evaluateToQStringListTriggerWarnings() PASS : tst_QXmlQuery::evaluateToQStringListNoConversion() PASS : tst_QXmlQuery::evaluateToQIODevice() PASS : tst_QXmlQuery::evaluateToQIODeviceTriggerWarnings() PASS : tst_QXmlQuery::evaluateToQIODeviceSignature() PASS : tst_QXmlQuery::evaluateToQIODeviceOnInvalidQuery() PASS : tst_QXmlQuery::setQueryQIODeviceQUrl() PASS : tst_QXmlQuery::setQueryQIODeviceQUrlTriggerWarnings() PASS : tst_QXmlQuery::setQueryQString() PASS : tst_QXmlQuery::setQueryQUrlSuccess() PASS : tst_QXmlQuery::setQueryQUrlFailSucceed() PASS : tst_QXmlQuery::setQueryQUrlFailure() PASS : tst_QXmlQuery::setQueryQUrlBaseURI() PASS : tst_QXmlQuery::setQueryWithNonExistentQUrlOnValidQuery() PASS : tst_QXmlQuery::setQueryWithInvalidQueryFromQUrlOnValidQuery() PASS : tst_QXmlQuery::retrieveNameFromQuery() PASS : tst_QXmlQuery::declareUnavailableExternal() PASS : tst_QXmlQuery::msvcCacheIssue() PASS : tst_QXmlQuery::unavailableExternalVariable() PASS : tst_QXmlQuery::useUriResolver() PASS : tst_QXmlQuery::queryWithFocusAndVariable() PASS : tst_QXmlQuery::undefinedFocus() PASS : tst_QXmlQuery::basicFocusUsage() PASS : tst_QXmlQuery::queryLanguage() PASS : tst_QXmlQuery::queryLanguageSignature() PASS : tst_QXmlQuery::enumQueryLanguage() PASS : tst_QXmlQuery::setNetworkAccessManager() PASS : tst_QXmlQuery::networkAccessManagerSignature() PASS : tst_QXmlQuery::networkAccessManagerDefaultValue() PASS : tst_QXmlQuery::networkAccessManager() PASS : tst_QXmlQuery::setInitialTemplateNameQXmlName() PASS : tst_QXmlQuery::setInitialTemplateNameQXmlNameSignature() PASS : tst_QXmlQuery::setInitialTemplateNameQString() PASS : tst_QXmlQuery::setInitialTemplateNameQStringSignature() PASS : tst_QXmlQuery::initialTemplateName() PASS : tst_QXmlQuery::initialTemplateNameSignature() PASS : tst_QXmlQuery::fnDocNetworkAccessSuccess() PASS : tst_QXmlQuery::fnDocNetworkAccessFailure() PASS : tst_QXmlQuery::multipleDocsAndFocus() PASS : tst_QXmlQuery::multipleEvaluationsWithDifferentFocus() QtQA::App::TestRunner: Timed out after 900 seconds QtQA::App::TestRunner: Process exited due to signal 6; dumped core QtQA::App::TestRunner: ============================== backtrace follows: ============================== QtQA::App::TestRunner: gdb commands: thread apply all bt 100 QtQA::App::TestRunner: [New Thread 11974] QtQA::App::TestRunner: QtQA::App::TestRunner: warning: Can't read pathname for load map: Input/output error. QtQA::App::TestRunner: Core was generated by `./tst_qxmlquery -o /home/qt/.pulse2-agent/data/recipes/147588207/base/_artifact'. QtQA::App::TestRunner: Program terminated with signal 6, Aborted. QtQA::App::TestRunner: #0 0x4001d430 in __kernel_vsyscall () QtQA::App::TestRunner: QtQA::App::TestRunner: Thread 1 (Thread 11974): QtQA::App::TestRunner: #0 0x4001d430 in __kernel_vsyscall () QtQA::App::TestRunner: #1 0x40bde651 in *__GI_raise (sig=6) QtQA::App::TestRunner: at ../nptl/sysdeps/unix/sysv/linux/raise.c:64 QtQA::App::TestRunner: #2 0x40be1a82 in *__GI_abort () at abort.c:92 QtQA::App::TestRunner: #3 0x406be8fd in qt_message_output (msgType=QtFatalMsg, QtQA::App::TestRunner: buf=0x42400dc0 "Received signal 15") at global/qglobal.cpp:2111 QtQA::App::TestRunner: #4 0x406beaf6 in qt_message (msgType=QtFatalMsg, QtQA::App::TestRunner: msg=0x4003e840 "Received signal %d", ap=0xbfe521c4 "\017") QtQA::App::TestRunner: at global/qglobal.cpp:2157 QtQA::App::TestRunner: #5 0x406bee5f in qFatal (msg=0x4003e840 "Received signal %d") QtQA::App::TestRunner: at global/qglobal.cpp:2335 QtQA::App::TestRunner: #6 0x4002ab15 in QTest::FatalSignalHandler::signal (signum=15) QtQA::App::TestRunner: at qtestcase.cpp:1781 QtQA::App::TestRunner: #7 <signal handler called> QtQA::App::TestRunner: #8 0x4001d430 in __kernel_vsyscall () QtQA::App::TestRunner: #9 0x40a69015 in pthread_cond_wait@@GLIBC_2.3.2 () QtQA::App::TestRunner: at ../nptl/sysdeps/unix/sysv/linux/i386/i686/../i486/pthread_cond_wait.S:122 QtQA::App::TestRunner: #10 0x406ca9e5 in QWaitConditionPrivate::wait (this=0x9507950, QtQA::App::TestRunner: time=4294967295) at thread/qwaitcondition_unix.cpp:86 QtQA::App::TestRunner: #11 0x406ca7ea in QWaitCondition::wait (this=0x95078d8, mutex=0x95078d0, QtQA::App::TestRunner: time=4294967295) at thread/qwaitcondition_unix.cpp:158 QtQA::App::TestRunner: #12 0x406c3b39 in QReadWriteLock::lockForWrite (this=0x95078c0) QtQA::App::TestRunner: at thread/qreadwritelock.cpp:293 QtQA::App::TestRunner: #13 0x4075e030 in QWriteLocker::relock (this=0xbfe528a0) QtQA::App::TestRunner: at ../../include/QtCore/../../src/corelib/thread/qreadwritelock.h:155 QtQA::App::TestRunner: #14 0x4075e0b6 in QWriteLocker (this=0xbfe528a0, areadWriteLock=0x95078c0) QtQA::App::TestRunner: at ../../include/QtCore/../../src/corelib/thread/qreadwritelock.h:175 QtQA::App::TestRunner: #15 0x40809856 in QMetaType::registerType ( QtQA::App::TestRunner: typeName=0x405d37b0 "QNetworkReply::NetworkError", QtQA::App::TestRunner: deleter=0x4051136e <void qMetaTypeDeleteHelper<QNetworkReply::NetworkError>(QNetworkReply::NetworkError*)>, QtQA::App::TestRunner: creator=0x40511325 <void* qMetaTypeCreateHelper<QNetworkReply::NetworkError>(QNetworkReply::NetworkError const*)>, QtQA::App::TestRunner: destructor=0x405113e8 <void qMetaTypeDestructHelper<QNetworkReply::NetworkError>(QNetworkReply::NetworkError*)>, QtQA::App::TestRunner: constructor=0x40511391 <void* qMetaTypeConstructHelper<QNetworkReply::NetworkError>(void*, QNetworkReply::NetworkError const*)>, size=4) QtQA::App::TestRunner: at kernel/qmetatype.cpp:449 QtQA::App::TestRunner: #16 0x4051076a in qRegisterMetaType<QNetworkReply::NetworkError> ( QtQA::App::TestRunner: typeName=0x405d37b0 "QNetworkReply::NetworkError", dummy=0x0) QtQA::App::TestRunner: at ../../include/QtCore/../../src/corelib/kernel/qmetatype.h:341 QtQA::App::TestRunner: #17 0x4050c20f in QNetworkAccessManager (this=0x42406770, parent=0x42401dd8) QtQA::App::TestRunner: at access/qnetworkaccessmanager.cpp:346 QtQA::App::TestRunner: #18 0x400c5f16 in URILoader (this=0x42406770, parent=0x42401dd8, np=..., QtQA::App::TestRunner: l=...) at api/quriloader.cpp:57 QtQA::App::TestRunner: #19 0x400cb4b4 in QXmlQueryPrivate::detach() () QtQA::App::TestRunner: from /home/qt/.pulse2-agent/data/recipes/147588207/base/qt/qtbase/lib/libQtXmlPatterns.so.5 QtQA::App::TestRunner: #20 0x400c9241 in QXmlQuery (this=0xbfe52c60, other=...) QtQA::App::TestRunner: at api/qxmlquery.cpp:272 QtQA::App::TestRunner: #21 0x400b6c87 in qMetaTypeConstructHelper<QXmlQuery> (where=0xbfe52c60, QtQA::App::TestRunner: t=0xbfe52d1c) QtQA::App::TestRunner: at ../../../qtbase/include/QtCore/../../src/corelib/kernel/qmetatype.h:274 QtQA::App::TestRunner: #22 0x408108e1 in customTypeConstructor (type=266, where=0xbfe52c60, QtQA::App::TestRunner: copy=0xbfe52d1c) at kernel/qmetatype.cpp:1437 QtQA::App::TestRunner: #23 0x4080d814 in delegate (this=0xbfe52b28, copy=0xbfe52d1c) QtQA::App::TestRunner: at kernel/qmetatype.cpp:1426 QtQA::App::TestRunner: #24 0x4080c225 in switcher<void*, <unnamed>::TypeConstructor<<unnamed>::DefinedTypesFilter> > (logic=..., type=266, data=0xbfe52d1c) QtQA::App::TestRunner: at kernel/qmetatypeswitcher_p.h:94 QtQA::App::TestRunner: #25 0x4080bb95 in QMetaType::construct (type=266, where=0xbfe52c60, QtQA::App::TestRunner: copy=0xbfe52d1c) at kernel/qmetatype.cpp:1476 QtQA::App::TestRunner: #26 0x4084080a in delegate (this=0xbfe52ba8) QtQA::App::TestRunner: at ../../include/QtCore/5.0.0/QtCore/private/../../../../../src/corelib/kernel/qvariant_p.h:366 QtQA::App::TestRunner: #27 0x4083edbd in switcher<void, QVariantConstructor<<unnamed>::CoreTypesFilter> > (logic=..., type=266, data=0x0) QtQA::App::TestRunner: at ../../include/QtCore/5.0.0/QtCore/private/../../../../../src/corelib/kernel/qmetatypeswitcher_p.h:94 QtQA::App::TestRunner: #28 0x408389eb in construct (x=0xbfe52c60, copy=0xbfe52d1c) QtQA::App::TestRunner: at kernel/qvariant.cpp:108 QtQA::App::TestRunner: #29 0x4083b5e7 in QVariant::create (this=0xbfe52c60, type=266, QtQA::App::TestRunner: copy=0xbfe52d1c) at kernel/qvariant.cpp:1021 QtQA::App::TestRunner: #30 0x4083bbb6 in QVariant (this=0xbfe52c60, typeOrUserType=266, QtQA::App::TestRunner: copy=0xbfe52d1c, flags=0) at kernel/qvariant.cpp:1311 QtQA::App::TestRunner: #31 0x400cd66b in QVariant qVariantFromValue<QXmlQuery>(QXmlQuery const&) () QtQA::App::TestRunner: from /home/qt/.pulse2-agent/data/recipes/147588207/base/qt/qtbase/lib/libQtXmlPatterns.so.5 QtQA::App::TestRunner: #32 0x400cd2d7 in QVariant QVariant::fromValue<QXmlQuery>(QXmlQuery const&) () QtQA::App::TestRunner: from /home/qt/.pulse2-agent/data/recipes/147588207/base/qt/qtbase/lib/libQtXmlPatterns.so.5 QtQA::App::TestRunner: #33 0x400cac5a in QXmlQuery::bindVariable (this=0xbfe52d14, name=..., QtQA::App::TestRunner: query=...) at api/qxmlquery.cpp:1187 QtQA::App::TestRunner: #34 0x400cad70 in QXmlQuery::bindVariable (this=0xbfe52d14, localName=..., QtQA::App::TestRunner: query=...) at api/qxmlquery.cpp:1206 QtQA::App::TestRunner: #35 0x0806ec72 in tst_QXmlQuery::bindVariableQXmlQuery (this=0xbfe536e4) QtQA::App::TestRunner: at tst_qxmlquery.cpp:3200 QtQA::App::TestRunner: #36 0x0807185a in tst_QXmlQuery::qt_static_metacall (_o=0xbfe536e4, QtQA::App::TestRunner: _c=QMetaObject::InvokeMetaMethod, _id=121, _a=0xbfe52dc0) QtQA::App::TestRunner: at .moc/debug-shared/tst_qxmlquery.moc:403 QtQA::App::TestRunner: #37 0x40805dfc in QMetaMethod::invoke (this=0xbfe52f2c, object=0xbfe536e4, QtQA::App::TestRunner: connectionType=Qt::DirectConnection, returnValue=..., val0=..., val1=..., QtQA::App::TestRunner: val2=..., val3=..., val4=..., val5=..., val6=..., val7=..., val8=..., QtQA::App::TestRunner: val9=...) at kernel/qmetaobject.cpp:1650 QtQA::App::TestRunner: #38 0x4080521e in QMetaObject::invokeMethod (obj=0xbfe536e4, QtQA::App::TestRunner: member=0x424055c0 "bindVariableQXmlQuery", type=Qt::DirectConnection, QtQA::App::TestRunner: ret=..., val0=..., val1=..., val2=..., val3=..., val4=..., val5=..., QtQA::App::TestRunner: val6=..., val7=..., val8=..., val9=...) at kernel/qmetaobject.cpp:1192 QtQA::App::TestRunner: #39 0x4002c794 in QMetaObject::invokeMethod (obj=0xbfe536e4, QtQA::App::TestRunner: member=0x424055c0 "bindVariableQXmlQuery", type=Qt::DirectConnection, QtQA::App::TestRunner: val0=..., val1=..., val2=..., val3=..., val4=..., val5=..., val6=..., QtQA::App::TestRunner: val7=..., val8=..., val9=...) QtQA::App::TestRunner: at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs.h:407 QtQA::App::TestRunner: #40 0x40029caa in qInvokeTestMethodDataEntry ( QtQA::App::TestRunner: slot=0x424055c0 "bindVariableQXmlQuery") at qtestcase.cpp:1493 QtQA::App::TestRunner: #41 0x4002a2b2 in qInvokeTestMethod ( QtQA::App::TestRunner: slotName=0x807d850 "bindVariableQXmlQuery()", data=0x0) QtQA::App::TestRunner: at qtestcase.cpp:1594 QtQA::App::TestRunner: #42 0x4002aa63 in qInvokeTestMethods (testObject=0xbfe536e4) QtQA::App::TestRunner: at qtestcase.cpp:1748 QtQA::App::TestRunner: #43 0x4002b187 in QTest::qExec (testObject=0xbfe536e4, argc=5, QtQA::App::TestRunner: argv=0xbfe537c4) at qtestcase.cpp:1956 QtQA::App::TestRunner: #44 0x08070ffb in main (argc=5, argv=0xbfe537c4) at tst_qxmlquery.cpp:3475
Also, an isolated testcase is forthcoming.
Attachments
For Gerrit Dashboard: QTBUG-22930 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
9996,1 | tst_qmetatype: added test for QMetaType::construct() hang bug | master | qt/qtbase | Status: ABANDONED | -1 | 0 |
10036,1 | Fix a deadlock in QMetaType. | master | qt/qtbase | Status: MERGED | +2 | 0 |