Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Unpredictable crashes with QThread/QtConcurrent on Linux (same application working on Windows)
Forum Updated to NodeBB v4.3 + New Features

Unpredictable crashes with QThread/QtConcurrent on Linux (same application working on Windows)

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 4.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    boelraty
    wrote on last edited by
    #1

    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.
    Best

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      welcome to devnet

      What are the versions of Qt for windows and linux you are using?
      Do they match?

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • B Offline
        B Offline
        boelraty
        wrote on last edited by
        #3

        I'm using Qt 4.8.0 on both platforms.

        On Windows, it works great with msvc and mingw as well.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          • B Offline
            B Offline
            boelraty
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            0
            • B Offline
              B Offline
              boelraty
              wrote on last edited by
              #6

              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 ?

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved