Bug 419603 - Crash when loading multiple videos in an empty project
Summary: Crash when loading multiple videos in an empty project
Status: RESOLVED FIXED
Alias: None
Product: kdenlive
Classification: Applications
Component: Video Display & Export (show other bugs)
Version: git-master
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: Jean-Baptiste Mardelle
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-03 19:51 UTC by Simon
Modified: 2020-04-07 18:34 UTC (History)
2 users (show)

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


Attachments
Variables for the stack trace (103.88 KB, image/png)
2020-04-03 19:51 UTC, Simon
Details
gdb log (104.44 KB, text/plain)
2020-04-05 00:56 UTC, farid
Details
Test_file_in_Windows-Explorer.PNG (111.75 KB, image/png)
2020-04-05 10:29 UTC, emohr
Details
Crash in audio thumbs (253.55 KB, image/png)
2020-04-07 10:03 UTC, Simon
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Simon 2020-04-03 19:51:36 UTC
Created attachment 127252 [details]
Variables for the stack trace

SUMMARY

When I open Kdenlive and add 5 videos, it asks me if I want to update the project profile while it already starts generating thumbnails. I click yes (so it changes to 1920x1050, 60 fps) and Kdenlive crashes.

The stack trace is below, the variables are in the attached file. The reason seems to be that 
> double consumer_aspect = mlt_profile_sar( mlt_service_profile( MLT_FILTER_SERVICE( filter ) ) );
returns NaN and then breaks the following computation, yielding SIGFPE.

filter_get_image filter_resize.c:256
mlt_frame_get_image mlt_frame.c:620
Mlt::Frame::get_image MltFrame.cpp:83
KThumb::getFrame kthumb.cpp:113
ThumbJob::startJob thumbjob.cpp:115
AbstractClipJob::execute abstractclipjob.cpp:59
QtConcurrent::FunctionWrapper1<bool, std::shared_ptr<AbstractClipJob> const&>::operator() qtconcurrentfunctionwrappers.h:80
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 qtconcurrentmapkernel.h:175
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 qtconcurrentmapkernel.h:185
QtConcurrent::IterateKernel<__gnu_cxx::__normal_iterator<std::shared_ptr<AbstractClipJob> const*, std::vector<std::shared_ptr<AbstractClipJob>, std::allocator<std::shared_ptr<AbstractClipJob> > > >, bool>::forThreadFunction qtconcurrentiteratekernel.h:255
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 qtconcurrentiteratekernel.h:217
QtConcurrent::ThreadEngineBase::run() 0x00007f3718c0acb5
<unknown> 0x00007f3716aca232
<unknown> 0x00007f3716ac6c92
start_thread 0x00007f3715d1b669
clone 0x00007f37165fc323
Comment 1 Jean-Baptiste Mardelle 2020-04-03 20:42:45 UTC
I did not manage to reproduce. However the cause for this is probably in the handling of jobs in jobmanager.cpp/ipp.

All MLT objects in a project share a same shared pointer to an MLT::Profile.
This Mlt profile holds the project basic infos like frame size, aspect ratio (sar/dar), fps, color space, etc.

On profile change, we do stop all ongoing jobs, then reset the profile and reload the clips. From the log it seems a thumbnail job on one of the clip is not stopped when the profile is reset, leading to a crash when MLT tries to compute data based on the profile.
Comment 2 farid 2020-04-05 00:56:13 UTC
I get a freeze with this:

Thread 1 (Thread 0x7fffec51ed80 (LWP 77218)):
#0  0x00007ffff1181a67 in __pthread_clockjoin_ex () at /usr/lib/libpthread.so.0
#1  0x00007fffe22fa228 in consumer_stop (parent=<optimized out>) at consumer_sdl2_audio.c:217
--Type <RET> for more, q to quit, c to continue without paging--
        self = 0x555561c27690
#2  0x00007ffff6fa13cc in mlt_consumer_stop (self=0x555561c27690) at mlt_consumer.c:1667
        properties = 0x555561c27690
        priv = 0x55555b517300
#3  0x0000555555b483c8 in GLWidget::setProducer(std::shared_ptr<Mlt::Producer> const&, bool, int) (this=0x555557fd55f0, producer=std::shared_ptr<Mlt::Producer> (empty) = {...}, isActive=true, position=-1) at /home/farid/kdenlive/src/monitor/glwidget.cpp:924
        error = 0
        currentId = {static null = {<No data fields>}, d = 0x555559ab29e0}
        consumerPosition = 327
#4  0x0000555555b5bbbc in Monitor::slotOpenClip(std::shared_ptr<ProjectClip> const&, int, int) (this=0x555557fdf7c0, controller=std::shared_ptr<ProjectClip> (empty) = {...}, in=-1, out=-1) at /home/farid/kdenlive/src/monitor/monitor.cpp:1445
#5  0x0000555555915d96 in Bin::<lambda(std::shared_ptr<ProjectClip>, int, int)>::operator()(std::shared_ptr<ProjectClip>, int, int) const (__closure=0x5555587fb020, clip=std::shared_ptr<ProjectClip> (empty) = {...}, in=-1, out=-1) at /home/farid/kdenlive/src/bin/bin.cpp:1538
        this = 0x555556cd3270
#6  0x000055555592f0b1 in QtPrivate::FunctorCall<QtPrivate::IndexesList<0, 1, 2>, QtPrivate::List<std::shared_ptr<ProjectClip>, int, int>, void, Bin::setMonitor(Monitor*)::<lambda(std::shared_ptr<ProjectClip>, int, int)> >::call(Bin::<lambda(std::shared_ptr<ProjectClip>, int, int)> &, void **) (f=..., arg=0x7fffffffcc90) at /usr/include/qt/QtCore/qobjectdefs_impl.h:146
#7  0x000055555592ebcb in QtPrivate::Functor<Bin::setMonitor(Monitor*)::<lambda(std::shared_ptr<ProjectClip>, int, int)>, 3>::call<QtPrivate::List<std::shared_ptr<ProjectClip>, int, int>, void>(Bin::<lambda(std::shared_ptr<ProjectClip>, int, int)> &, void *, void **) (f=..., arg=0x7fffffffcc90) at /usr/include/qt/QtCore/qobjectdefs_impl.h:256
#8  0x000055555592e79a in QtPrivate::QFunctorSlotObject<Bin::setMonitor(Monitor*)::<lambda(std::shared_ptr<ProjectClip>, int, int)>, 3, QtPrivate::List<std::shared_ptr<ProjectClip>, int, int>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void **, bool *) (which=1, this_=0x5555587fb010, r=0x555556cd3270, a=0x7fffffffcc90, ret=0x0) at /usr/include/qt/QtCore/qobjectdefs_impl.h:439
--Type <RET> for more, q to quit, c to continue without paging--
#9  0x00007ffff1f8bcde in  () at /usr/lib/libQt5Core.so.5
#10 0x00005555557f930a in Bin::openClip(std::shared_ptr<ProjectClip>, int, int) (this=0x555556cd3270, _t1=std::shared_ptr<ProjectClip> (empty) = {...}, _t2=-1, _t3=-1) at /home/farid/kdenlive/build/src/kdenliveLib_autogen/NNRPYQ7WAA/moc_bin.cpp:1475
        _a = {0x0, 0x7fffffffcd10, 0x7fffffffcc7c, 0x7fffffffcc78}
#11 0x0000555555919964 in Bin::selectProxyModel(QModelIndex const&) (this=0x555556cd3270, id=...) at /home/farid/kdenlive/src/bin/bin.cpp:1847
#12 0x000055555593f707 in QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QModelIndex const&>, void, void (Bin::*)(QModelIndex const&)>::call(void (Bin::*)(QModelIndex const&), Bin*, void**) (f=(void (Bin::*)(Bin * const, const QModelIndex &)) 0x55555591917e <Bin::selectProxyModel(QModelIndex const&)>, o=0x555556cd3270, arg=0x7fffffffcf00) at /usr/include/qt/QtCore/qobjectdefs_impl.h:152
#13 0x000055555593d5fd in QtPrivate::FunctionPointer<void (Bin::*)(QModelIndex const&)>::call<QtPrivate::List<QModelIndex const&>, void>(void (Bin::*)(QModelIndex const&), Bin*, void**) (f=(void (Bin::*)(Bin * const, const QModelIndex &)) 0x55555591917e <Bin::selectProxyModel(QModelIndex const&)>, o=0x555556cd3270, arg=0x7fffffffcf00) at /usr/include/qt/QtCore/qobjectdefs_impl.h:185
#14 0x000055555593ad0d in QtPrivate::QSlotObject<void (Bin::*)(QModelIndex const&), QtPrivate::List<QModelIndex const&>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (which=1, this_=0x55555a3dc680, r=0x555556cd3270, a=0x7fffffffcf00, ret=0x0) at /usr/include/qt/QtCore/qobjectdefs_impl.h:414
#15 0x00007ffff1f8bcde in  () at /usr/lib/libQt5Core.so.5
#16 0x00005555557fbc46 in ProjectSortProxyModel::selectModel(QModelIndex const&) (this=0x55555a3dc120, _t1=...) at /home/farid/kdenlive/build/src/kdenliveLib_autogen/NNRPYQ7WAA/moc_projectsortproxymodel.cpp:203
        _a = {0x0, 0x7fffffffcf60}
#17 0x000055555599d5c6 in ProjectSortProxyModel::onCurrentRowChanged(QItemSelection const&, QItemSelection const&) (this=0x55555a3dc120, current=..., previous=...) at /home/farid/kdenlive/src/bin/projectsortproxymodel.cpp:167
        indexes = {<QListSpecialMethods<QModelIndex>> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = {<std::__atomic_base<int>> = {static _S_alignment = 4, _M_i = -1}, <No data fields>}}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x7ffff203f310 <QListData::shared_null>}, d = 0x7ffff203f310 <QListData::shared_null>}}
--Type <RET> for more, q to quit, c to continue without paging--
#18 0x000055555599e048 in QtPrivate::FunctorCall<QtPrivate::IndexesList<0, 1>, QtPrivate::List<QItemSelection const&, QItemSelection const&>, void, void (ProjectSortProxyModel::*)(QItemSelection const&, QItemSelection const&)>::call(void (ProjectSortProxyModel::*)(QItemSelection const&, QItemSelection const&), ProjectSortProxyModel*, void**) (f=(void (ProjectSortProxyModel::*)(ProjectSortProxyModel * const, const QItemSelection &, const QItemSelection &)) 0x55555599d560 <ProjectSortProxyModel::onCurrentRowChanged(QItemSelection const&, QItemSelection const&)>, o=0x55555a3dc120, arg=0x7fffffffd140) at /usr/include/qt/QtCore/qobjectdefs_impl.h:152
#19 0x000055555599df4e in QtPrivate::FunctionPointer<void (ProjectSortProxyModel::*)(QItemSelection const&, QItemSelection const&)>::call<QtPrivate::List<QItemSelection const&, QItemSelection const&>, void>(void (ProjectSortProxyModel::*)(QItemSelection const&, QItemSelection const&), ProjectSortProxyModel*, void**) (f=(void (ProjectSortProxyModel::*)(ProjectSortProxyModel * const, const QItemSelection &, const QItemSelection &)) 0x55555599d560 <ProjectSortProxyModel::onCurrentRowChanged(QItemSelection const&, QItemSelection const&)>, o=0x55555a3dc120, arg=0x7fffffffd140) at /usr/include/qt/QtCore/qobjectdefs_impl.h:185
#20 0x000055555599de1f in QtPrivate::QSlotObject<void (ProjectSortProxyModel::*)(QItemSelection const&, QItemSelection const&), QtPrivate::List<QItemSelection const&, QItemSelection const&>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (which=1, this_=0x55555a3dc890, r=0x55555a3dc120, a=0x7fffffffd140, ret=0x0) at /usr/include/qt/QtCore/qobjectdefs_impl.h:418
#21 0x00007ffff1f8bcde in  () at /usr/lib/libQt5Core.so.5
#22 0x00007ffff1f08391 in QItemSelectionModel::selectionChanged(QItemSelection const&, QItemSelection const&) () at /usr/lib/libQt5Core.so.5                                                                                                
#23 0x00007ffff1f0db5c in QItemSelectionModel::emitSelectionChanged(QItemSelection const&, QItemSelection const&) () at /usr/lib/libQt5Core.so.5
#24 0x00007ffff1f11245 in QItemSelectionModel::select(QItemSelection const&, QFlags<QItemSelectionModel::SelectionFlag>) () at /usr/lib/libQt5Core.so.5
#25 0x00007ffff1f0a5ce in QItemSelectionModel::select(QModelIndex const&, QFlags<QItemSelectionModel::SelectionFlag>) () at /usr/lib/libQt5Core.so.5
#26 0x00007ffff6918a2d in QAbstractItemView::mouseReleaseEvent(QMouseEvent*) () at /usr/lib/libQt5Widgets.so.5
#27 0x00007ffff6994504 in QTreeView::mouseReleaseEvent(QMouseEvent*) () at /usr/lib/libQt5Widgets.so.5
#28 0x00007ffff66e62ee in QWidget::event(QEvent*) () at /usr/lib/libQt5Widgets.so.5
--Type <RET> for more, q to quit, c to continue without paging--
#29 0x00007ffff6797cbf in QFrame::event(QEvent*) () at /usr/lib/libQt5Widgets.so.5
#30 0x00007ffff6922d70 in QAbstractItemView::viewportEvent(QEvent*) () at /usr/lib/libQt5Widgets.so.5
#31 0x00007ffff6993c7c in QTreeView::viewportEvent(QEvent*) () at /usr/lib/libQt5Widgets.so.5
#32 0x00007ffff1f56203 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5                                                                                                          
#33 0x00007ffff66a2341 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#34 0x00007ffff66aba78 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#35 0x00007ffff1f564f2 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5
#36 0x00007ffff66aaaeb in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) () at /usr/lib/libQt5Widgets.so.5
#37 0x00007ffff6701b21 in  () at /usr/lib/libQt5Widgets.so.5
#38 0x00007ffff6704aa4 in  () at /usr/lib/libQt5Widgets.so.5
#39 0x00007ffff66a2352 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#40 0x00007ffff66ab829 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#41 0x00007ffff1f564f2 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5
#42 0x00007ffff231e2a4 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () at /usr/lib/libQt5Gui.so.5                                                                                               
#43 0x00007ffff231f9b6 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () at /usr/lib/libQt5Gui.so.5
#44 0x00007ffff22f7c5c in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Gui.so.5                                                                                               
#45 0x00007fffebe2fe2c in  () at /usr/lib/libQt5XcbQpa.so.5
#46 0x00007fffefc3e9be in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
#47 0x00007fffefc40831 in  () at /usr/lib/libglib-2.0.so.0
#48 0x00007fffefc40871 in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#49 0x00007ffff1fae890 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#50 0x00007ffff1f5505c in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
--Type <RET> for more, q to quit, c to continue without paging--
#51 0x00007ffff1f5d066 in QCoreApplication::exec() () at /usr/lib/libQt5Core.so.5
#52 0x000055555572cac5 in main(int, char**) (argc=1, argv=0x7fffffffe6b8) at /home/farid/kdenlive/src/main.cpp:256
        app = <incomplete type>
        pixmap = <incomplete type>
        splash = <incomplete type>
        config = {d = 0x555556396a50}
        grp = <incomplete type>
        __PRETTY_FUNCTION__ = "int main(int, char**)"
        programDBusService = <incomplete type>
        forceBreeze = true
        aboutData = {static staticMetaObject = {d = {superdata = {direct = 0x0}, stringdata = 0x7ffff6e1b3c0, data = 0x7ffff6e1b2c0, static_metacall = 0x7ffff6dba0f0, relatedMetaObjects = 0x0, extradata = 0x0}}, d = 0x55555685a440}
        loader = 0x7ffff75d5040
        parser = {d = 0x555556b21130}
        clipsToLoad = {static null = {<No data fields>}, d = 0x7ffff203e840 <QArrayData::shared_null>}
        url = {d = 0x0}
        result = 0


See full log attached. Hope it helps...
Comment 3 farid 2020-04-05 00:56:50 UTC
Created attachment 127284 [details]
gdb log
Comment 4 emohr 2020-04-05 08:28:32 UTC
On Windows: drag/drop or import 5 videos from folder into project bin -> no crash
Comment 5 Simon 2020-04-05 09:25:34 UTC
@emohr Did you also test with those files? These are the ones I used.
https://drive.google.com/drive/folders/15eeOt4QqKmyQdu6hgPscT0EyWjIha7pt?usp=sharing
Comment 6 emohr 2020-04-05 10:29:08 UTC
Created attachment 127289 [details]
Test_file_in_Windows-Explorer.PNG

Yes. No crash -> neither by drag/drop nor import 6 videos from folder into project bin
But 4 files showing up upside down in the windows explorer.
Comment 7 Jean-Baptiste Mardelle 2020-04-07 08:07:49 UTC
Git commit 067917f7d5c214c09a2ea7cebc39f88edec3b94f by Jean-Baptiste Mardelle.
Committed on 07/04/2020 at 08:07.
Pushed by mardelle into branch 'release/20.04'.

Fix possible crash or freeze on multiple clip import.

M  +11   -1    src/bin/bin.cpp
M  +8    -4    src/jobs/cachejob.cpp
M  +2    -0    src/jobs/cachejob.hpp
M  +11   -0    src/jobs/thumbjob.cpp
M  +2    -0    src/jobs/thumbjob.hpp

https://invent.kde.org/kde/kdenlive/commit/067917f7d5c214c09a2ea7cebc39f88edec3b94f
Comment 8 Simon 2020-04-07 10:03:47 UTC
Created attachment 127342 [details]
Crash in audio thumbs
Comment 9 Simon 2020-04-07 10:04:39 UTC
Thanks, this already fixed the crash I got for the files I have uploaded.

I tried another selection of files and I get a crash again, but in a different location. Screenshot is attached.

Can also put it into a separate bug report if you want.
Comment 10 Jean-Baptiste Mardelle 2020-04-07 11:12:12 UTC
Git commit cfba686149f79ee6526a6ae40769f537c207b8cc by Jean-Baptiste Mardelle.
Committed on 07/04/2020 at 11:11.
Pushed by mardelle into branch 'release/20.04'.

Fix possible crash on audio thumbs abort

M  +5    -0    src/jobs/audiothumbjob.cpp

https://invent.kde.org/kde/kdenlive/commit/cfba686149f79ee6526a6ae40769f537c207b8cc
Comment 11 Simon 2020-04-07 18:33:54 UTC
Thank you, fixed now!
Comment 12 Simon 2020-04-07 18:34:11 UTC
The new dialog looks nice and friendly btw! :)