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. QProgressDialog or MainWindow with table Crashes when using with MultiThread
Forum Updated to NodeBB v4.3 + New Features

QProgressDialog or MainWindow with table Crashes when using with MultiThread

Scheduled Pinned Locked Moved Solved General and Desktop
16 Posts 5 Posters 2.0k 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.
  • Maaz MominM Offline
    Maaz MominM Offline
    Maaz Momin
    wrote on last edited by Maaz Momin
    #7

    @jsulm I have updated StackTrace.

    @J-Hilk As you can the parenting is already done in start processing function. Edit: Also in constructor i have initialized it to NULL

    jsulmJ 1 Reply Last reply
    0
    • Maaz MominM Maaz Momin

      @jsulm I have updated StackTrace.

      @J-Hilk As you can the parenting is already done in start processing function. Edit: Also in constructor i have initialized it to NULL

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #8

      @Maaz-Momin Please post whole stack trace (what you posted is cut at the bottom).

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      Maaz MominM 1 Reply Last reply
      0
      • jsulmJ jsulm

        @Maaz-Momin Please post whole stack trace (what you posted is cut at the bottom).

        Maaz MominM Offline
        Maaz MominM Offline
        Maaz Momin
        wrote on last edited by
        #9

        @jsulm The stacktrace seems to be almost 1000 table lines. Won't be able to post that many screenshots. Are you looking for something in particular?

        1 Reply Last reply
        0
        • dheerendraD Offline
          dheerendraD Offline
          dheerendra
          Qt Champions 2022
          wrote on last edited by dheerendra
          #10

          If I look at your program this is what I understood.

          1. There is only one progress Dialog created in mainWindow
          2. You are creating the multiple Worker object & each running in different threads.
          3. You have connected each of those worker object signals to progress dialog & vice/versa

          Now

          Can you show me how are you connecting progress value from worker to progress dialog ? Are you making any direct connection to update the progress ?
          Are you calling setValue of progressdialog from any of the worker threads ?

          Dheerendra
          @Community Service
          Certified Qt Specialist
          http://www.pthinks.com

          Maaz MominM 1 Reply Last reply
          0
          • dheerendraD dheerendra

            If I look at your program this is what I understood.

            1. There is only one progress Dialog created in mainWindow
            2. You are creating the multiple Worker object & each running in different threads.
            3. You have connected each of those worker object signals to progress dialog & vice/versa

            Now

            Can you show me how are you connecting progress value from worker to progress dialog ? Are you making any direct connection to update the progress ?
            Are you calling setValue of progressdialog from any of the worker threads ?

            Maaz MominM Offline
            Maaz MominM Offline
            Maaz Momin
            wrote on last edited by
            #11

            @dheerendra

            Q) Can you show me how are you connecting progress value from worker to progress dialog ? Are you making any direct connection to update the progress ? Are you calling setValue of progressdialog from any of the worker threads ?

            Ans) No i am not connecting Worker to Progress. I wait for Worker to finish and trigger MainWindow's onProcessingFinished() slot. From this slot I call progressDialog ->setValue.

            1 Reply Last reply
            0
            • Maaz MominM Offline
              Maaz MominM Offline
              Maaz Momin
              wrote on last edited by
              #12

              @jsulm @J-Hilk @dheerendra I just saw that i am also getting this error message in Issue panel.

              "f:\dd\vctools\crt\vcstartup\src\misc\i386\chkstk.asm:99: error: Debugger encountered an exception: Exception at 0x625ab439, code: 0xc00000fd: stack_overflow, flags=0x0 (first chance)"

              kshegunovK 1 Reply Last reply
              0
              • dheerendraD Offline
                dheerendraD Offline
                dheerendra
                Qt Champions 2022
                wrote on last edited by
                #13

                Debugger & trace is the only choice to find the issue. Since code is with you, only you can troubleshoot better. From our side it is only guess work. However some inputs from my side.

                1. I'm seeing the stack_overflow. Is there any method getting called recursively ?
                2. You are doing the foreach. How many worker threads you are creating ?
                3. You are doing the moveToThread of worker. Does worker has any children objects ?
                4. Just to rule out that issue is happening from ProgressBar, we can remove everything insid onProcessingFinished(). Just have debug statement. Just see how it behaves.
                5. We can restrict the number of threads to just one, see how it behaves.

                Please note that above are some hints for moving forward & not sure shot for troubleshooting.

                Tools like WinDBG should clearly point out the issue.

                Dheerendra
                @Community Service
                Certified Qt Specialist
                http://www.pthinks.com

                1 Reply Last reply
                1
                • Maaz MominM Maaz Momin

                  @jsulm @J-Hilk @dheerendra I just saw that i am also getting this error message in Issue panel.

                  "f:\dd\vctools\crt\vcstartup\src\misc\i386\chkstk.asm:99: error: Debugger encountered an exception: Exception at 0x625ab439, code: 0xc00000fd: stack_overflow, flags=0x0 (first chance)"

                  kshegunovK Offline
                  kshegunovK Offline
                  kshegunov
                  Moderators
                  wrote on last edited by
                  #14

                  @Maaz-Momin said in QProgressDialog or MainWindow with table Crashes when using with MultiThread:

                  @jsulm @J-Hilk @dheerendra I just saw that i am also getting this error message in Issue panel.

                  "f:\dd\vctools\crt\vcstartup\src\misc\i386\chkstk.asm:99: error: Debugger encountered an exception: Exception at 0x625ab439, code: 0xc00000fd: stack_overflow, flags=0x0 (first chance)"

                  Which is what I'd've guessed from this:

                  @jsulm The stacktrace seems to be almost 1000 table lines. Won't be able to post that many screenshots. Are you looking for something in particular?

                  Look over your code (and trace). There's probably a signal that's emitted secondary to a slot which is triggered by the same signal. I don't believe this to be a threading issue per se.

                  Read and abide by the Qt Code of Conduct

                  1 Reply Last reply
                  1
                  • Maaz MominM Offline
                    Maaz MominM Offline
                    Maaz Momin
                    wrote on last edited by
                    #15

                    I traced over my code and but find any signal-slot recursive but i guess I understood the reason as the error suggest it's stack_overflow.

                    I am trying to read all the files in a folder(recursive) and process the files. My logic was to create each thread with total file size of 50KB.

                    but when I try this on a large folder say around (3.5MB and above) then only the program crashes.

                    My Log: '44' Batch(Thread) created for '390' files with total file size 3501128 bytes.

                    @SGaist @aha_1980 @mrjj @jsulm @J-Hilk @dheerendra @kshegunov Can you guys advise on how to handle Multiple-File reading and processing in MultiThread.

                    1 Reply Last reply
                    0
                    • Maaz MominM Offline
                      Maaz MominM Offline
                      Maaz Momin
                      wrote on last edited by
                      #16

                      I found a way how I can work with this. The anwser is QThread::idealThreadCount. Thank you for your help.

                      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