Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.9.3
-
None
-
Winows 10 64 bit
Qt 5.9.3
MinGW 5.3.0 64 bit
Description
Sending debug output messages using qInfo() / qDebug() from several threads created using QtConcurrent::run() inside tests executed by QTest::exec() result in application crush, due to memory corruption inside buffers.
qInfo() works fine if used in multithreaded environment outisde of Qt test framework, so it looks like the problem is that some message handlers introduced in QTest::exec() contains race conditions.
Minimal example code which reproduce bug is attached.
Output of the minimal exmple on my system is as follows:
- Start testing of TestClass *********
Config: Using QtTest library 5.9.3, Qt 5.9.3 (x86_64-little_endian-llp64 shared (dynamic) debug build; by GCC 5.3.0)
PASS : TestClass::initTestCase()
QDEBUG : TestClass::TestRaceCondition() This will lead to race condition
QDEBUG : TestClass::TestRaceCondition() This will lead to race condition
PASS : TestClass::TestRaceCondition()
QDEBUG : TestClass::TestRaceCondition() This will lead to race condition
PASS : TestClass::cleanupTestCase()
Totals: 3 passed, 0 failed, 0 skipped, 0 blacklisted, 4ms
- Finished testing of TestClass *********
- Start testing of TestClass *********
Config: Using QtTest library 5.9.3, Qt 5.9.3 (x86_64-little_endian-llp64 shared (dynamic) debug build; by GCC 5.3.0)
This will lead to race condition
alive?
PASS : TestClass::initTestCase()
QDEBUG : TestClass::TestRaceCondition() This will lead to race condition
PASS : TestClass::TestRaceCondition()
PASS : TestClass::cleanupTestCase()
Totals: 3 passed, 0 failed, 0 skipped, 0 blacklisted, 1ms
- Finished testing of TestClass *********
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
I also inculde Qt portion of stack trace of crush in real application. Application uses TeamCity formatting of output, but it is not essential to reproduce crush.