Uploaded image for project: 'Picard'
  1. Picard
  2. PICARD-1963

Possible stack overflow when loading files

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: 2.4.4
    • Fix Version/s: 2.5.0b1
    • Component/s: Other
    • Labels:
      None

      Description

      Under certain circumstances Picard can crash with a stack overflow when loading a larger amount of files.

      I can only reliable reproduce this on one system (KDE Neon, Python 3.6.9, Qt 5.14.2, PyQt 5.14.1) with a certain set of files, but in theory it can happen everywhere.

      The basic recursion happening is this:

      1. After a file's load method has finished the callback tagger._file_loaded is set as a callback. This callback is not called immediately, but is put on the event queue via a ProxyToMainEvent by the picard.util.thread module.
      2. Under certain circumstances many of those ProxyToMainEvent(tagger._file_loaded) events can pile up
      3. When invoked tagger._file_loaded calls tagger.move_files, which in return calls QCoreApplication.processEvents
      4. QCoreApplication.processEvents processes the next event in the queue by calling tagger.even. If this again is a ProxyToMainEvent(tagger._file_loaded) this again calls tagger.move_files and QCoreApplication.processEvents. We get a recursion

      With proper timing and enough files to be loaded this can get into a situation where the maximum stack depth gets used up.

      File "./picard/tagger.py", line 402 in event
      File "./picard/util/thread.py", line 47 in run
      File "./picard/file.py", line 218 in _loading_finished
      File "./picard/tagger.py", line 456 in _file_loaded
      File "./picard/tagger.py", line 473 in move_files
      File "./picard/tagger.py", line 402 in event
      File "./picard/util/thread.py", line 47 in run
      File "./picard/file.py", line 218 in _loading_finished
      File "./picard/tagger.py", line 456 in _file_loaded
      File "./picard/tagger.py", line 473 in move_files
      File "./picard/tagger.py", line 402 in event
      File "./picard/util/thread.py", line 47 in run
      File "./picard/file.py", line 218 in _loading_finished
      ...

      See crash.log for full output.

        Attachments

          Activity

            People

            Assignee:
            outsidecontext Philipp Wolfer
            Reporter:
            outsidecontext Philipp Wolfer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:

                Packages

                Version Package
                2.5.0b1