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

Possible stack overflow when loading files

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: High High
    • 2.5.0b1
    • 2.4.4
    • Other
    • None

      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.

        1. crash.log
          10 kB
          Philipp Wolfer

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

              Created:
              Updated:

                Version Package
                2.5.0b1