Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Unpredictable crashes with QThread/QtConcurrent on Linux (same application working on Windows)
Hi, I'm trying to move an application developed on Windows to Linux.
Unfortunately, the application on Linux crashes occasionally (not each time - unpredictable behavior). After some tests, I have been able to identify the origin of my crashes. It is related to the use of QThread/QtConcurrent. Indeed, I replace the code using thread by no-threaded code, and the application works great.
My use of the QThread is mainly around QtConcurrent in order to apply computations on list of elements.
The application is working very well on Windows even with thread enabled.
Do you have any idea why I get undesired crashes on Linux?
How can I solve this ?
Can it be related to compilation option in Qt ?
Thank you for your help.
koahnig last edited by
welcome to devnet
What are the versions of Qt for windows and linux you are using?
Do they match?
I'm using Qt 4.8.0 on both platforms.
On Windows, it works great with msvc and mingw as well.
andre last edited by
Windows and Linux use different scheduling algorithms for threads and processes, so I guess you are experiencing some kind of race condition. Do your threads access any non-tread local piece of data? Is that access protected by a mutex? Do they communicate?
Threading can be the source of many subtle bugs. It is unfortunately very hard to help without seeing and analyzing the actual code.
Error from myself, I get the same problems on Windows with MinGW. Thius, it is certainly related to GCC.
Regarding your questions Andre, my threads access data stored in list/map and apply computations on each element. There is no specific communication between threads and I'm using mutex when needed.
Ok ready to give further information.
Here what I'm doing :
QFuture<void> l_future = QtConcurrent::map(LIST, ReadImage(some useful args));
The LIST variable is a QStringList containing file path. The ReadImage() method is a function objects used to read a file.
Here the gdb trace :
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7d99b70 (LWP 6572)]
__memmove_ssse3 () at ../sysdeps/i386/i686/multiarch/memcpy-ssse3.S:1277
1277 ../sysdeps/i386/i686/multiarch/memcpy-ssse3.S: N
Do you have any idea ?