Bug 363951

Summary: Keeps randomly crashing (segfault) by just using it every couple of minutes
Product: [Applications] kdenlive Reporter: roland
Component: User Interface & MiscellaneousAssignee: Jean-Baptiste Mardelle <jb>
Status: RESOLVED WAITINGFORINFO    
Severity: grave CC: wegwerf-1-2-3
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description roland 2016-06-04 18:01:11 UTC
Random crashes all the time. Happens randomly by these actions:
- Click on a Strip
- Switch to Composite transition
- Switch to different combine-with element from drop down box
- Try to edit a title strip
- Even just by scrolling in the time line


Reproducible: Always


Actual Results:  
#0  0x00007fac221c4fcf in pthread_cond_wait () from /lib64/libpthread.so.0
#1  0x00007fac1e65ad19 in _xcb_conn_wait () from /usr/lib64/libxcb.so.1
#2  0x00007fac1e65c5a7 in wait_for_reply () from /usr/lib64/libxcb.so.1
#3  0x00007fac1e65c6c3 in xcb_wait_for_reply () from /usr/lib64/libxcb.so.1
#4  0x00007fac1b8509ea in QXcbConnection::sync() () from /usr/lib64/libQt5XcbQpa.so.5
#5  0x00007fac1b870c46 in QXcbShmImage::preparePaint(QRegion const&) () from /usr/lib64/libQt5XcbQpa.so.5
#6  0x00007fac1b870f9e in QXcbBackingStore::beginPaint(QRegion const&) () from /usr/lib64/libQt5XcbQpa.so.5
#7  0x00007fac25201163 in QWidgetBackingStore::doSync() () from /usr/lib64/libQt5Widgets.so.5
#8  0x00007fac25201761 in QWidgetBackingStore::sync() () from /usr/lib64/libQt5Widgets.so.5
#9  0x00007fac25222d6f in QWidgetPrivate::syncBackingStore() () from /usr/lib64/libQt5Widgets.so.5
#10 0x00007fac252390e0 in QWidget::event(QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#11 0x00007fac25337a53 in QMainWindow::event(QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#12 0x00007fac2719b995 in KMainWindow::event(QEvent*) () from /usr/lib64/libKF5XmlGui.so.5
#13 0x00007fac271d7323 in KXmlGuiWindow::event(QEvent*) () from /usr/lib64/libKF5XmlGui.so.5
#14 0x00007fac251f3b3c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#15 0x00007fac251f9098 in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#16 0x00007fac243591b4 in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib64/libQt5Core.so.5
#17 0x00007fac2435c028 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib64/libQt5Core.so.5
#18 0x00007fac243a6f83 in postEventSourceDispatch(_GSource*, int (*)(void*), void*) () from /usr/lib64/libQt5Core.so.5
#19 0x00007fac1eacaf94 in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0
#20 0x00007fac1eacb275 in g_main_context_iterate.isra () from /usr/lib64/libglib-2.0.so.0
#21 0x00007fac1eacb334 in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#22 0x00007fac243a6ff4 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#23 0x00007fac24357dda in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#24 0x00007fac2435f2d4 in QCoreApplication::exec() () from /usr/lib64/libQt5Core.so.5
#25 0x0000000000463c0a in main ()
Comment 1 Wegwerf 2016-06-05 12:54:18 UTC
Roland, which version of Kdenlive, MLT, and ffmpeg/avconf do you use? Where did you get them from? Distribution repository, Kdenlive project repository, or self-compiled? I'm afraid that with the terse information given, the backtrace won't be of much use, more so as the crash is probably randomly in the pthread_cond_wait.
Comment 2 roland 2016-06-05 14:16:06 UTC
The crash is of generic nature. I've replicated it also on a out-of-the box installation of Kubuntu 16.04 LTS 64-Bit. Just install KDEnlive right after installing the Distro and it segfaults straight away.

The stack trace though is from my GenToo system. So it's self-compiled. Here the information which might help. The crashes happen both with 15.12.3 and 16.04.1 and both on GenToo and Kubuntu.

KDEnlive ( https://gitweb.gentoo.org/repo/gentoo.git/tree/kde-apps/kdenlive ): kdenlive-15.12.3
MLT ( https://gitweb.gentoo.org/repo/gentoo.git/tree/media-libs/mlt ): media-libs/mlt-0.9.8-r2
FFMpeg ( https://gitweb.gentoo.org/repo/gentoo.git/tree/media-video/ffmpeg ): media-video/ffmpeg-2.8.6

USE flags (defines what is compiled in. usually maps rather directly to configure options, - prefixed means disabled).

media-libs/mlt-0.9.8-r2::gentoo  USE="ffmpeg frei0r gtk jack kdenlive libsamplerate lua melt opengl python qt5 sdl xml -compressed-lumas -debug -fftw -kde -libav -qt4 -rtaudio (-ruby) -vdpau -xine" CPU_FLAGS_X86="mmx sse sse2" PYTHON_TARGETS="python2_7"

media-video/ffmpeg-2.8.6:0/54.56.56::gentoo  USE="X aac alsa bzip2 encode fontconfig frei0r gpl hardcoded-tables iconv jack ladspa modplug mp3 network openal opengl postproc samba sdl theora threads truetype vorbis vpx x264 xcb xvid zlib -aacplus (-altivec) -amr -amrenc (-armv5te) (-armv6) (-armv6t2) (-armvfp) -bluray -bs2b -cdio -celt -cpudetection -debug -doc -examples -faac -fdk -flite -fribidi -gme -gnutls -gsm -iec61883 -ieee1394 -jpeg2k -libass -libcaca (-libressl) -librtmp -libsoxr -libv4l -lzma (-mipsdspr1) (-mipsdspr2) (-mipsfpu) (-neon) -openssl -opus -oss -pic -pulseaudio -quvi -schroedinger -snappy -speex -ssh -static-libs {-test} -twolame -v4l -vaapi -vdpau -wavpack -webp -x265 -zvbi" ABI_X86="(64) -32 (-x32)" CPU_FLAGS_X86="avx fma3 fma4 mmx mmxext sse sse2 sse3 sse4_1 sse4_2 ssse3 xop -3dnow -3dnowext -avx2" FFTOOLS="aviocat cws2fws ffescape ffeval ffhash fourcc2pixfmt graph2dot ismindex pktdumper qt-faststart sidxindex trasher"

If you need more I can try adding the information.
Comment 3 Wegwerf 2016-06-05 14:43:28 UTC
Roland,

a few things I notice:

1. MLT is outdated, you should upgrade to MLT 6.0.x or 6.2.x if possible. The version gap looks larger than it actually is, but there have been some important bug fixes in MLT with respect to Kdenlive. So if possible, please upgrade MLT.

2. 15.12.3 isn't supported anymore, but you mentioned 16.04.1, so this is recent.

3. The stack trace doesn't seem to make much sense to me at the moment, I'll try to explain why. What is curious is that you may see a crash in pthread_cond_wait() ... is this actually the thread that crashed or is this just the stack trace of one of the multiple Kdenlive threads? What crash did you actually see, a segmentation fault, bus error, or ... ? I've seen "crashes" mostly in pthread_cond_wait() when the crash actually was in a different thread. Of course, I may be on the wrong track here, so that's why I'm asking.

In case you didn't already do it this way: can you please run gdb src/kdenlive from your kdenlive build folder. When kdenlive crashes, is the "bt" command giving the same back trace?
Comment 4 roland 2016-06-05 21:26:30 UTC
1) MLT >= 6.0 is masked "testing" in GenToo which is usually for a reason. But Kubuntu has 6.0.0-2 and there it segfaults too so that should not be the reason.

3) Unfortunatly I can't. When I run it with GDB and it crashed KCrash steals the process from GDB and I end up with no stack trace. I see though some strange entries in the GDB before it crashes:

QXcbConnection: XCB error: 8 (BadMatch), sequence: 30604, resource id: 67109068, major code: 131 (Unknown), minor code: 3
QXcbConnection: XCB error: 8 (BadMatch), sequence: 30620, resource id: 67109068, major code: 131 (Unknown), minor code: 3
QXcbConnection: XCB error: 8 (BadMatch), sequence: 30637, resource id: 67109068, major code: 131 (Unknown), minor code: 3
QXcbConnection: XCB error: 8 (BadMatch), sequence: 30656, resource id: 67109068, major code: 131 (Unknown), minor code: 3
( a lot of these actually)

and some of these:
Attempting to create QWindow-based QOffscreenSurface outside the gui thread. Expect failures.

or this one:
Overwriting existing old cached entry due to collision.
Overwriting existing old cached entry due to collision.

Not sure how to get around KCrash when using GDB
Comment 5 Wegwerf 2016-06-06 07:32:53 UTC
Roland, thank you for your information.

1)  Agreed. However, there is no reason for masking MLT 6.0.x as this is a rock solid release. And it has the ugly titler crash finally fixed. But, as you said, that's of no concern for the moment.

2) The XCB errors usually can be ignored, they are seen on many systems and seem to stem from Qt. When you run your self-compiled Kdenlive (from build/src) under gdb control then KCrash should not interfere. This is what I experience on my Kubuntu 16.04 installation.

What kind of graphics card and drivers do you use? Kdenlive requires OpenGL. Did you disable movit, the GPU acceleration support in Kdenlive? In case you should have it enabled, can you please disable it? Also, can you please make sure that you've set processing threads set to 1 in Kdenlive's configure dialog?

And what is also strange: I'm on a Kubuntu 16.04 stock installation, but have compiled my own Kdenlive from (bleeding) git master, as well as MLT, and ffmpeg. This has proven to be a solid combination independent of any distro woes. The stock components are Qt5 and KF5, as well as X11 and the graphics card driver -- which is the open source AMD Radeon driver with an HD 7700/7800. But unfortunately, you are seeing a lot of crashes on your system.

So this brings me to the last question I can ask: what kind of system do you have? Did you experience any other odd system behavior that may hint at a faulty RAM bank or similar? Does other graphics-heavy software, such as Blender, Natron, GIMP with large images, work correctly? If yes, this then can probably safely wipe out RAM woes.

To be honest, I'm dazzled...
Comment 6 roland 2016-06-06 16:41:57 UTC
GPU is a Radeon HD 7970 with Catalyst ( https://packages.gentoo.org/packages/x11-drivers/ati-drivers ).

Processing threads is already set to 1. What about concurrent threads?

Looking at the USE flags I would say OpenGL is already disabled:
kde-apps/kdenlive-15.12.3:5::gentoo  USE="handbook -debug -gles2 -v4l" 

Where is "moveit"? I can not find it in the configuration dialog.

Otherwise the RAM is certainly not the problem. I'm doing game-deving so the machine is regularly stressed GPU/RAM wise.
Comment 7 Wegwerf 2016-06-06 16:46:35 UTC
OpenGL must be *enabled*, as Kdenlive relies on it for display. Movit is the experimental GPU accel support, it's fine to have it off -- it's something about use GPU acceleration or the like; I was just asking to ensure that this is not caused by movit.

Concurrent threads can (and should) be set to a higher value, depending on your system. Only processing threads=1 is important for now as otherwise the timeline playhead won't respond correctly. Also just to be on the safe side here.