Bug 426640 - Kdenlive 20.08.1 freezes when opening some projects created by 19.08.1 but not others
Summary: Kdenlive 20.08.1 freezes when opening some projects created by 19.08.1 but no...
Status: RESOLVED FIXED
Alias: None
Product: kdenlive
Classification: Applications
Component: User Interface (show other bugs)
Version: 20.08.1
Platform: Other Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: emohr
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-17 13:51 UTC by ahiijny
Modified: 2020-12-13 20:11 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 20.12.0
fritzibaby: Brainstorm+


Attachments
Projects that freeze when opened in 20.08.1 (48.12 KB, application/x-zip-compressed)
2020-09-17 19:31 UTC, ahiijny
Details
Debug output when opening projects with nightly build 520 (33.15 KB, application/x-zip-compressed)
2020-09-20 20:23 UTC, ahiijny
Details
Project created in 20.04.0 which freezes (347.30 KB, application/xml)
2020-09-24 00:56 UTC, Jeroen
Details
Debug output when opening projects with nightly build 544 (5.12 KB, application/x-zip-compressed)
2020-10-15 00:06 UTC, ahiijny
Details
An mkv file with 33 streams (1.33 MB, video/x-matroska)
2020-11-28 15:54 UTC, ahiijny
Details
Bug_426640_Crashlog (11.95 KB, text/plain)
2020-11-28 16:14 UTC, emohr
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ahiijny 2020-09-17 13:51:26 UTC
SOFTWARE/OS VERSIONS
Windows 10
Kdenlive 20.08.1 (standalone)
MLT version 6.23.0
KDE Frameworks 5.71.0
Qt 5.15.0 (built against 5.15.0)
The windows windowing system
(And if it helps, my locale is en_CA.)

DESCRIPTION
I've been using 19.08.1 (not standalone version) for my video editing projects for the last year or so, and I decided to try the latest version. But I ran into some troubles when trying to open some of my existing projects with the newer version.

Kdenlive hangs on the "loading clips..." dialog and then stops responding. I waited for a few minutes just in case it was taking a bit longer to load than usual, but it still didn't respond, so I ended up having to end kdenlive with task manager.

For some projects, rarely, the project seems to load okay at first: The clips show up in the project bin and the clips in the timeline appear, too. And sometimes I can even click the "play" button, and it plays the project on the timeline... for about 1 second. And then everything freezes and the window stops responding.

The strange thing is, some projects open just fine. Others don't. I noticed that smaller projects with fewer clips in the project bin tend to be the ones that open successfully, while larger projects with a lot more clips and subclips in the bin tend to be the ones that freeze on open. For the projects that freeze on open, they freeze every time (so I can't work on them :/).

I've also tried doing all the following before starting kdenlive 20.08.1:
- deleting kdenliverc from AppData/Local
- deleting the kdenlive folder from AppData/Local
- deleting the kdenlive folder from AppData/Roaming (well, I made a copy of it to save for later)
- clicking Help > Reset Configuration, just for good measure

But the freezes still happen.

After trying all this, I checked if I could still open the problematic projects in 19.08.1, and yes, I could still open them and edit them there.

OBSERVATIONS
I tried creating some simple projects in 19.08.1 from scratch and then opening them in 20.08.1:
- A project with a single image in the project bin (opens fine)
- A project with a title clip in the project bin (opens fine)
- A project with a colour clip in the project bin (opens fine)
- A project with an mp4 clip, a colour clip, and 6 images in the project bin + 5 video tracks and 5 audio tracks and a bunch of stuff in the timeline, with crop and alpha shapes and transform effects (opens fine)
- A project with 57 mkv videos in the project bin (opens fine)
- A project with 30 mkv videos in the project bin (opens fine)
- A project with 4 mkv videos in the project bin (opens fine)
- A project with 57 png images in the project bin (freezes)
- A project with 30 png images in the project bin (freezes)
- A project with 16 png images in the project bin (opens fine)

I tried creating the same projects from scratch in 20.08.1:
- A project with 57 png images in the project bin (opens fine)
- A project with 30 png images in the project bin (opens fine)
- A project with 16 png images in the project bin (opens fine)

To clarify, these are all projects with just clips in the project bin, and nothing in the timeline.

But, if I then delete kdenliverc and the kdenlive folders in AppData/Local and AppData/Roaming:
- The earlier 20.08.1 project with 57 png images in the project bin (freezes)
- The earlier 20.08.1 project with 30 png images in the project bin (freezes)
- The earlier 20.08.1 project with 16 png images in the project bin (opens fine)

There was also this bizarre sequence of events:
1. Open Kdenlive 19.08.1 and Help > Reset configuration
2. Create a new 720p 23.98 fps project
3. Drag 57 pngs into project bin
4. Save As > "Project with 57 png images"
5. Delete 27 pngs from project bin and Save As > "Project with 30 png images"
6. Delete 14 pngs from project bin and Save As > "Project with 16 png images"
7. Delete 8 pngs from project bin and Save As > "Project with 8 png images"
8. Delete kdenliverc and AppData/Local/kdenlive/cache
9. Open Kdenlive 20.08.1 and Help > Reset configuration
10. Open "Project with 57 png images" in 20.08.1 (freezes)
11. Open "Project with 30 png images" in 20.08.1 (freezes)
12. Open "Project with 16 png images" in 20.08.1 (freezes)
13. Open "Project with 8 png images" in 20.08.1 (opens fine)
14. Open "Project with 16 png images" in 20.08.1 (opens fine) <- ?????
15. Open "Project with 30 png images" in 20.08.1 (freezes)
16. Open "Project with 57 png images" in 20.08.1 (freezes)

I can reproduce this sequence if I delete the cache in AppData/Local/kdenlive. Basically, 16-png freezes on open every time. But if I open 8-png, then from that point on, 16-png will open successfully every time.

It's a bit weird that the freezing happens with images but not video clips?

But I'll note that for my projects that fail to open, most of these projects don't contain any image files in the project bin; they only have only mkv videos and mp3 audio tracks.

I also downloaded the Windows nightly build kdenlive-master-517-windows-mingw_64-gcc (2020-09-16) and used it to try and open some of the problematic projects, but I got freezes with this version too.

MORE DETAILS
I used gdb to try and capture some of the debug outputs when loading these projects. There weren't any debug symbols in the exe though, so I don't think I can get a stack trace or anything.

For one of my projects, the debug output stopped here:

```
warning: === LOADING SUBCLIP WITH RATING:  0 , TAGS:  ""
warning: === LOADING SUBCLIP WITH RATING:  0 , TAGS:  ""
warning: ################### JOB finished:  0
warning: QQmlContext: Cannot set context object on invalid context.
warning: QQmlComponent: Cannot create a component in an invalid context
warning: QQmlContext: Cannot set context object on invalid context.
warning: QQmlComponent: Cannot create a component in an invalid context
warning: ################### JOB finished:  2
warning: ################### JOB finished:  4
warning: ################### JOB finished:  6
warning: ################### JOB finished:  1
warning: ################### JOB finished:  8
warning: ################### JOB finished:  9
warning: ################### JOB finished:  10
warning: ################### JOB finished:  5
warning: ################### JOB finished:  12
warning: ################### JOB finished:  3
[New Thread 1392.0x3324]
[New Thread 1392.0x3a28]
[New Thread 1392.0x3ec0]
[New Thread 1392.0x207c]
[New Thread 1392.0xe94]
[New Thread 1392.0x3dac]
[New Thread 1392.0x3550]
[New Thread 1392.0x1e34]
[New Thread 1392.0x3f50]
warning: ################### JOB finished:  14
warning: ################### JOB finished:  7
warning: ################### JOB finished:  16

Thread 1 received signal SIGSEGV, Segmentation fault.
0x00000000688d77d8 in ?? () from C:\Users\{MyName}\Applications\Kdenlive\kdenlive-master-517-windows-mingw_64-gcc\bin\Qt5Core.dll
```

For another one of my projects, the output stopped here:

```
CLIPS COUNT:  4
warning: REGISTRATION  14 ptr count 3
warning: // EFFECT  0  :  deinterlace
warning: // EFFECT  1  :  fieldorder
warning: // EFFECT  2  :  crop
warning: // EFFECT  3  :  swscale
warning: // EFFECT  4  :  resize
warning: // EFFECT  5  :  swresample
warning: // EFFECT  6  :  resample
warning: // EFFECT  7  :  data_feed
warning: // EFFECT  8  :  avcolor_space
warning: // EFFECT  9  :  audioconvert
[Thread 3944.0x3aac exited with code 0]
[Thread 3944.0xeec exited with code 0]
[Thread 3944.0x3de4 exited with code 0]
[Thread 3944.0x11c exited with code 0]
[Thread 3944.0x32a0 exited with code 0]
[Thread 3944.0x3d94 exited with code 0]
[Thread 3944.0x26e4 exited with code 0]
[Thread 3944.0x2df0 exited with code 0]
[Thread 3944.0x3a60 exited with code 0]
warning: qml: loaded clip:  546 , ID:  14 , index:  0 , TYPE: AV
warning: qml: loaded clip with Astream:  1
warning: Inserted clip in track 10 at  546
warning: Looking for clip with ID  6  and name
warning:  // /REQUEST TL CLP REGSTR:  15
--------
CLIPS COUNT:  5
warning: REGISTRATION  15 ptr count 3

Thread 138 received signal SIGSEGV, Segmentation fault.
[Switching to Thread 3944.0x2328]
0x00007ffe832a315e in avcodec_flush_buffers () from C:\Users\{MyName}\Applications\Kdenlive\kdenlive-master-517-windows-mingw_64-gcc\bin\avcodec-58.dll
```

For another one of my projects (this one has lots of image files in the bin), it ended like this:

```
warning: === LOADING SUBCLIP WITH RATING:  0 , TAGS:  ""
warning: ################### JOB finished:  3
warning: ################### JOB finished:  1
warning: ################### JOB finished:  5
warning: ################### JOB finished:  2
warning: ################### JOB finished:  7
warning: QQmlContext: Cannot set context object on invalid context.
warning: QQmlComponent: Cannot create a component in an invalid context
warning: QQmlContext: Cannot set context object on invalid context.
warning: QQmlComponent: Cannot create a component in an invalid context
warning: ################### JOB finished:  0
warning: ################### JOB finished:  9
[New Thread 15576.0x3ee4]
[New Thread 15576.0x3a54]
warning: kf.config.core: "KConfigIni: In file C:/Users/{MyName}/AppData/Local/kdenliverc, line 9: " "Invalid escape sequence \"\\A\"."

...snip...

warning: kf.config.core: "KConfigIni: In file C:/Users/{MyName}/AppData/Local/kdenliverc, line 23: " "Invalid escape sequence \"\\o\"."
[Thread 15576.0x3a54 exited with code 0]
[Thread 15576.0x1b30 exited with code 0]
[Thread 15576.0x3840 exited with code 0]
[Thread 15576.0x27a0 exited with code 0]
[Thread 15576.0x39a4 exited with code 0]
```

...And then it just stopped responding after that. The UI was frozen and even after waiting 10 minutes, it didn't print anything else. This result was also more or less what I saw with the test projects containing only images in the project bin. i.e. no segfault, just stopped responding.

Hope someone can figure out what's going on here :/

But anyway, I'm falling back to using 19.08.1 for the time being.
Comment 1 emohr 2020-09-17 16:50:07 UTC
Please upload the three (3) 19.08.1 project files here (maybe you have to zip it because of the size). Seems to be similar to Bug 409477 which contains pictures as well. With 20.08 we made some change about locals.
Comment 2 ahiijny 2020-09-17 19:31:28 UTC
Created attachment 131728 [details]
Projects that freeze when opened in 20.08.1

First one is the one that segfaults in Qt5Core.dll
Second one is the one that segfaults in avcodec-58.dll
Third one is the one with images that just hangs

Sometimes these freeze while loading clips, and other times they freeze shortly after the timeline loads (if I click around for a bit)

Password is "the three"
Comment 3 emohr 2020-09-19 10:31:33 UTC
Please try with nightly build https://binary-factory.kde.org/job/Kdenlive_Nightly_mingw64/520/ which contains a fix. I could load all 3 files with placeholders.
Comment 4 ahiijny 2020-09-20 20:23:00 UTC
Created attachment 131814 [details]
Debug output when opening projects with nightly build 520

Hm, I'm still getting the same freezes with the latest build.

1 and 2 freeze while loading clips. With project 3, the timeline and bin load, but when I click "play" on the timeline, nothing happens. And it freezes after I try playing a bin clip.

I attached a copy-paste of the debug output (when running the exe with gdb), just in case it helps (same password).
Comment 5 Jeroen 2020-09-23 08:26:40 UTC
I have the same problem in 20.08.1 (installer version). Application freezes at "Loading clips" when opening my project. Tested with nightly build 524 as well (standalone), with the same result. 
https://binary-factory.kde.org/job/Kdenlive_Nightly_mingw64/524/

I also removed the local cache folder, but that did not help.

Windows 10 1809

What output would be helpful to debug this problem?
Comment 6 emohr 2020-09-23 15:54:21 UTC
I assume loading the clips lead to a freeze as I can load projects with placeholders. Please upload the project file here which leads to the freeze.
Comment 7 Jeroen 2020-09-24 00:56:10 UTC
Created attachment 131892 [details]
Project created in 20.04.0 which freezes

I have added my project file which leads to the freeze as well
Comment 8 Jeroen 2020-10-14 07:12:39 UTC
Seems to be fixed with build #544.
ahiijny can you check as well?
Comment 9 emohr 2020-10-14 14:47:48 UTC
@ahiijny@gmail.com Please check with the actual daily build if the issue is solved.
Comment 10 ahiijny 2020-10-15 00:06:33 UTC
Created attachment 132370 [details]
Debug output when opening projects with nightly build 544

I tried it with build 544.

My 1.kdenlive and 3.kdenlive load successfully now, and I can confirm that playback in the timeline works as expected without any freezing.

My 2.kdenlive still crashes when I try to open it, though.

When I tried running it through gdb, it shows the same segfault error last time, in avcodec_flush_buffers() from bin\avcodec-58.dll.

When I try to open 2.kdenlive in 19.08.1, it opens fine, so I don't think the project file is corrupt or anything like that.
Comment 11 ahiijny 2020-10-15 00:17:41 UTC
Tried it with build 546 as well. Same as above. 1.kdenlive and 3.kdenlive load successfully. But with 2.kdenlive, kdenlive freezes during the load, and then a short while later, the kdenlive process terminates.
Comment 12 Bug Janitor Service 2020-10-30 04:33:28 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 13 ahiijny 2020-10-30 19:47:22 UTC
Info provided above.
Comment 14 emohr 2020-10-31 08:17:23 UTC
2.kdenlive has box brackets "[ ]" in the file name more than ones. If you remove these box brackets "[ ]" in the file name Kdenlive still crashes?
Comment 15 ahiijny 2020-11-28 15:41:30 UTC
I tried renaming and moving my files so that they didn't have any square brackets in the path, but it was still crashing.

I managed to build kdenlive locally using Craft, but for some reason the UI wouldn't appear if I ran kdenlive.exe using gdb. So I did the hacky thing of copying the kdenlive.exe.sym file to the bin folder of the kdenlive-20.08.3_standalone folder that I downloaded from the kdenlive website. I managed to get a backtrace:

Thread 132 received signal SIGSEGV, Segmentation fault.
[Switching to Thread 4224.0x1aac]
0x00007ff90aed10ee in avcodec_flush_buffers () from C:\CraftRoot\kdenlive-20.08.3_standalone\bin\avcodec-58.dll
(gdb) bt
#0  0x00007ff90aed10ee in avcodec_flush_buffers () from C:\CraftRoot\kdenlive-20.08.3_standalone\bin\avcodec-58.dll
#1  0x0000000069689fe0 in ?? () from C:\CraftRoot\kdenlive-20.08.3_standalone\lib\mlt\libmltavformat.dll
#2  0x0000000069ac37fd in ?? () from C:\CraftRoot\kdenlive-20.08.3_standalone\bin\libmlt-6.dll
#3  0x000000006a3cec39 in ?? () from C:\CraftRoot\kdenlive-20.08.3_standalone\lib\mlt\libmltcore.dll
#4  0x0000000069ac37fd in ?? () from C:\CraftRoot\kdenlive-20.08.3_standalone\bin\libmlt-6.dll
#5  0x000000006a3cf1be in ?? () from C:\CraftRoot\kdenlive-20.08.3_standalone\lib\mlt\libmltcore.dll
#6  0x0000000069ac37fd in ?? () from C:\CraftRoot\kdenlive-20.08.3_standalone\bin\libmlt-6.dll
#7  0x000000006400327c in ?? () from C:\CraftRoot\kdenlive-20.08.3_standalone\bin\libmlt++-3.dll
#8  0x0000000000559664 in KThumb::getFrame (frame=0x73a076e0, width=256, height=144, scaledWidth=256) at C:/CraftRoot/build/_/3377f5a/kdenlive-20.08.3/src/doc/kthumb.cpp:113
#9  0x00000000005c0a96 in ThumbJob::startJob (this=0x57d43020) at C:/CraftRoot/build/_/3377f5a/kdenlive-20.08.3/src/jobs/thumbjob.cpp:125
#10 0x0000000000842e92 in QtConcurrent::FunctionWrapper1<bool, std::shared_ptr<AbstractClipJob> const&>::operator() (this=0x73440af8, u=std::shared_ptr<AbstractClipJob> (use count 2, weak count 0) = {...})
    at C:/CraftRoot/include/qt5/QtConcurrent/qtconcurrentfunctionwrappers.h:78
#11 QtConcurrent::MappedEachKernel<__gnu_cxx::__normal_iterator<std::shared_ptr<AbstractClipJob> const*, std::vector<std::shared_ptr<AbstractClipJob>, std::allocator<std::shared_ptr<AbstractClipJob> > > >, QtConcurrent::FunctionWrapper1<bool, std::shared_ptr<AbstractClipJob> const&> >::runIteration (result=0x5db6aa68, it=..., this=0x73440ac0) at C:/CraftRoot/include/qt5/QtConcurrent/qtconcurrentmapkernel.h:175
#12 QtConcurrent::MappedEachKernel<__gnu_cxx::__normal_iterator<std::shared_ptr<AbstractClipJob> const*, std::vector<std::shared_ptr<AbstractClipJob>, std::allocator<std::shared_ptr<AbstractClipJob> > > >, QtConcurrent::FunctionWrapper1<bool, std::shared_ptr<AbstractClipJob> const&> >::runIterations (this=0x73440ac0, sequenceBeginIterator=..., beginIndex=<optimized out>, endIndex=1, results=0x5db6aa68)
    at C:/CraftRoot/include/qt5/QtConcurrent/qtconcurrentmapkernel.h:185
#13 0x0000000000945caf in virtual thunk to QtConcurrent::IterateKernel<__gnu_cxx::__normal_iterator<std::shared_ptr<AbstractClipJob> const*, std::vector<std::shared_ptr<AbstractClipJob>, std::allocator<std::shared_ptr<AbstractClipJob> > > >, bool>::threadFunction() () at C:/CraftRoot/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/stl_iterator.h:801
#14 0x000000006a2c1a15 in ?? () from C:\CraftRoot\kdenlive-20.08.3_standalone\bin\Qt5Concurrent.dll
#15 0x000000006889da8c in ?? () from C:\CraftRoot\kdenlive-20.08.3_standalone\bin\Qt5Core.dll
#16 0x0000000068898f5a in ?? () from C:\CraftRoot\kdenlive-20.08.3_standalone\bin\Qt5Core.dll
#17 0x00007ff95a6e7c24 in KERNEL32!BaseThreadInitThunk () from C:\Windows\System32\kernel32.dll
#18 0x00007ff95c12d4d1 in ntdll!RtlUserThreadStart () from C:\Windows\SYSTEM32\ntdll.dll
#19 0x0000000000000000 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

I used the "The project file contains missing clips or files" dialog to remove clips and try and isolate which file was causing the problem. I eventually narrowed it down to one file, the one GX mkv video file.

When I dragged that single file into the project bin of a brand new Kdenlive 20.08.3 project, it crashed shortly afterwards. This happens reliably every time. Which is very strange, because this doesn't happen in 19.08.1.
Comment 16 ahiijny 2020-11-28 15:54:39 UTC
Created attachment 133701 [details]
An mkv file with 33 streams

Okay, I think I managed to get a minimal working example of a video file that can reproduce the crash

I used ffprobe on my video file that was causing the crash and noticed it had an abnormally high number of streams (33, mostly TrueType fonts) compared to my other video files that didn't cause crashes.

So I tried creating a video file with a similar number of streams using this command:

$ ffmpeg -i chirp.mp4 -f srt -i subs.srt -map 0:0 -map 0:1 -map 1:0 -map 1:0 -map 1:0 -map 1:0 -map 1:0 -map 1:0 -map 1:0 -map 1:0 -map 1:0 -map 1:0 -map 1:0 -map 1:0 -map 1:0 -map 1:0 -map 1:0 -map 1:0 -map 1:0 -map 1:0 -map 1:0 -map 1:0 -map 1:0 -map 1:0 -map 1:0 -map 1:0 -map 1:0 -map 1:0 -map 1:0 -map 1:0 -map 1:0 -map 1:0 -map 1:0 -c:v copy -c:a copy -c:s srt out.mkv

And if I try to load this mkv file into a new project, it crashes too!

Steps to reproduce:
1. Open a new Kdenlive project
2. Drag the attached mkv file into the project bin
3. Kdenlive will crash
Comment 17 emohr 2020-11-28 16:14:55 UTC
Created attachment 133702 [details]
Bug_426640_Crashlog

Super, I didn't manage to run gdb! So you just put kdenlive.exe.sym into the bin folder of 20.08.3, change to that directory and run gdb?

I can reproduce the crash. Out.mkv contains 33 text streams. Attached the console crashlog.
Comment 18 ahiijny 2020-11-28 16:29:46 UTC
> So you just put kdenlive.exe.sym into the bin folder of 20.08.3, change to that directory and run gdb?

Yeah, pretty much.

I have no idea why gdb seems to work well with the official release kdenlive.exe but not the CraftRoot kdenlive.exe though
Comment 19 Jean-Baptiste Mardelle 2020-11-29 02:32:55 UTC
Thanks for your investigations. The video file triggers a bug in MLT that doesn't correctly handle files with more than 32 streams. I will send a patch for MLT in the next days and will try to implement a workaround in Kdenlive. WIll keep you informed.
Comment 20 emohr 2020-12-07 20:14:29 UTC
This is fixed with MLT commit https://github.com/mltframework/mlt/commit/378e3c78a37592b71b1a04a1734505ce9324d027. 

Please try with the daily build.
Comment 21 ahiijny 2020-12-13 20:11:18 UTC
I tried it with Windows nightly build #606 and can confirm that the project opens fine now :D