Bug 356133 - crash when starting - segmentation fault
Summary: crash when starting - segmentation fault
Status: RESOLVED FIXED
Alias: None
Product: kamoso
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Arch Linux Linux
: NOR grave
Target Milestone: ---
Assignee: Aleix Pol
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-30 23:07 UTC by majo63
Modified: 2017-02-16 23:40 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Shutting down gracefully at startup in case of missing plugin. (4.03 KB, patch)
2016-06-04 21:27 UTC, Lisa
Details

Note You need to log in before you can comment on or make changes to this bug.
Description majo63 2015-11-30 23:07:27 UTC
$ kamoso
Playing device changed "/dev/video0"
Cannot initialize model with data QJsonObject() . missing: QJsonValue(string, "urls")
new gamma 109
file:///usr/lib/qt/qml/QtQuick/Controls/Slider.qml:199:5: QML RangeModel: Binding loop detected for property ""
New saturation  100
New contrast  100
[1]    10865 segmentation fault (core dumped)  kamoso


Reproducible: Always

Steps to Reproduce:
1. $ kamoso of from start menu
2.
3.

Actual Results:  
crash - segmentation fault, window just flick

Expected Results:  
run program

version in arch linux: kamoso 3.0-1
Comment 1 majo63 2015-11-30 23:10:07 UTC
coredump is too big to upload
Comment 2 Cyril Brosch 2015-12-05 20:19:03 UTC
I confirm. Kamoso crashes when USB webcam is plugged it, but it starts when it is not plugged in (plugin it in afterwards does nothing, but trying to get a picture then crashes Kamoso again). 

gdb gives me just the following output:

#0  0x000000000041a9d0 in WebcamControl::play(Device*) ()                                                                    
#1  0x000000000041b680 in WebcamControl::WebcamControl() ()                                                                  
#2  0x00000000004129fc in main ()
Comment 3 Raghavendra kamath 2015-12-13 18:25:32 UTC
+1 I encounter this exact same problem

Here is the gdb backtrace - 

gdb kamoso
GNU gdb (GDB) 7.10
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from kamoso...(no debugging symbols found)...done.
(gdb) run
Starting program: /usr/bin/kamoso 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7fffe3bf5700 (LWP 2017)]
[New Thread 0x7fffda4f8700 (LWP 2018)]
[New Thread 0x7fffd91b5700 (LWP 2019)]
Playing device changed "/dev/video0"
[New Thread 0x7fffd20c3700 (LWP 2020)]
[New Thread 0x7fffd1842700 (LWP 2021)]
Cannot initialize model with data QJsonObject() . missing: QJsonValue(string, "urls")
new gamma 108
file:///usr/lib/qt/qml/QtQuick/Controls/Slider.qml:199:5: QML RangeModel: Binding loop detected for property ""
New saturation  100
New contrast  100

Program received signal SIGSEGV, Segmentation fault.
0x000000000041aa70 in WebcamControl::play(Device*) ()
(gdb) thread apply all backtrace

Thread 6 (Thread 0x7fffd1842700 (LWP 2021)):
#0  0x00007ffff120607f in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
#1  0x00007ffff42a5c0b in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQt5Core.so.5
#2  0x00007fffd235e442 in ?? () from /usr/lib/qt/qml/Qt/labs/folderlistmodel/libqmlfolderlistmodelplugin.so
#3  0x00007ffff42a497e in ?? () from /usr/lib/libQt5Core.so.5
#4  0x00007ffff12004a4 in start_thread () from /usr/lib/libpthread.so.0
#5  0x00007ffff399613d in clone () from /usr/lib/libc.so.6

Thread 5 (Thread 0x7fffd20c3700 (LWP 2020)):
#0  0x00007ffff120607f in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
#1  0x00007ffff42a5c0b in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQt5Core.so.5
#2  0x00007fffd235e442 in ?? () from /usr/lib/qt/qml/Qt/labs/folderlistmodel/libqmlfolderlistmodelplugin.so
#3  0x00007ffff42a497e in ?? () from /usr/lib/libQt5Core.so.5
#4  0x00007ffff12004a4 in start_thread () from /usr/lib/libpthread.so.0
#5  0x00007ffff399613d in clone () from /usr/lib/libc.so.6

Thread 4 (Thread 0x7fffd91b5700 (LWP 2019)):
#0  0x00007ffff398d18d in poll () from /usr/lib/libc.so.6
#1  0x00007ffff068bfbc in ?? () from /usr/lib/libglib-2.0.so.0
#2  0x00007ffff068c0cc in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#3  0x00007ffff44dc30f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /usr/lib/libQt5Core.so.5
#4  0x00007ffff448333a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /usr/lib/libQt5Core.so.5
#5  0x00007ffff429f9d4 in QThread::exec() () from /usr/lib/libQt5Core.so.5
#6  0x00007ffff5048a75 in ?? () from /usr/lib/libQt5Qml.so.5
#7  0x00007ffff42a497e in ?? () from /usr/lib/libQt5Core.so.5
#8  0x00007ffff12004a4 in start_thread () from /usr/lib/libpthread.so.0
#9  0x00007ffff399613d in clone () from /usr/lib/libc.so.6

Thread 3 (Thread 0x7fffda4f8700 (LWP 2018)):
#0  0x00007ffff398d18d in poll () from /usr/lib/libc.so.6
#1  0x00007ffff068bfbc in ?? () from /usr/lib/libglib-2.0.so.0
#2  0x00007ffff068c0cc in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#3  0x00007ffff44dc30f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /usr/lib/libQt5Core.so.5
#4  0x00007ffff448333a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /usr/lib/libQt5Core.so.5
#5  0x00007ffff429f9d4 in QThread::exec() () from /usr/lib/libQt5Core.so.5
#6  0x00007ffff5048a75 in ?? () from /usr/lib/libQt5Qml.so.5
#7  0x00007ffff42a497e in ?? () from /usr/lib/libQt5Core.so.5
#8  0x00007ffff12004a4 in start_thread () from /usr/lib/libpthread.so.0
#9  0x00007ffff399613d in clone () from /usr/lib/libc.so.6

Thread 2 (Thread 0x7fffe3bf5700 (LWP 2017)):
#0  0x00007ffff398d18d in poll () from /usr/lib/libc.so.6
#1  0x00007fffecea0ae2 in ?? () from /usr/lib/libxcb.so.1
#2  0x00007fffecea2757 in xcb_wait_for_event () from /usr/lib/libxcb.so.1
#3  0x00007fffe616de89 in ?? () from /usr/lib/libQt5XcbQpa.so.5
#4  0x00007ffff42a497e in ?? () from /usr/lib/libQt5Core.so.5
#5  0x00007ffff12004a4 in start_thread () from /usr/lib/libpthread.so.0
#6  0x00007ffff399613d in clone () from /usr/lib/libc.so.6
---Type <return> to continue, or q <return> to quit---

Thread 1 (Thread 0x7ffff7ef1800 (LWP 2013)):
#0  0x000000000041aa70 in WebcamControl::play(Device*) ()
#1  0x000000000041b75f in WebcamControl::WebcamControl() ()
#2  0x0000000000412bec in main ()
Comment 4 darkosmart 2015-12-22 19:01:25 UTC
+1
Comment 5 Raghavendra kamath 2016-03-27 15:15:54 UTC
for me this problem has gone away, if it has stopped for others too we can close this bug.
Comment 6 majo63 2016-03-28 19:45:53 UTC
same for me, closing
Comment 7 Raghavendra kamath 2016-04-12 09:46:10 UTC
This bug has resurfaced again
Comment 8 Cyril Brosch 2016-04-12 09:51:55 UTC
It has never been fixed for me, too.
Comment 9 majo63 2016-04-13 08:50:40 UTC
$ pacman -Q kamoso
kamoso 3.1.0-2

in this version, there is no segfault
Comment 10 Raghavendra kamath 2016-04-13 08:52:47 UTC
I have the same version , but  i get the segfault like earlier.

a month ago it started working but died again , My graphic card is nvidia and i don't remember if the drivers got updated
Comment 11 Lisa 2016-06-03 18:41:55 UTC
Hello, I have tried both 3.1.0 and the latest version from Git: same segfault. I am on Chakra Linux. 
I'll try and debug some more these days and come up with either more information or a patch.

@Raghavendra, what do you mean with "earlier"? Can you post the trace?
Comment 12 Lisa 2016-06-04 12:32:35 UTC
More information: the crash is caused by the fact that the element factory "wrappercamerabinsrc" does not exist on the system, therefore a null element is returned.

This should be part of gstreamer-bad-plugins. Before installing the bad plugins I run "gst-inspect-0.10 | grep camera" and got an empty output. After installing them, I get this:

camerabin2:  camerabin2: CameraBin2
camerabin2:  wrappercamerabinsrc: V4l2 camera src element for camerabin
camerabin2:  viewfinderbin: Viewfinder Bin
bayer:  bayer2rgb: Bayer to RGB decoder for cameras
camerabin:  camerabin: Camera Bin

but I still cannot get kamoso to find it, i.e. QGst::ElementFactory::find fails too, not just ::make.
Comment 13 Lisa 2016-06-04 18:56:24 UTC
Regarding my comment "but I still cannot get kamoso to find it, i.e. QGst::ElementFactory::find fails too, not just ::make.", that is because on Chakra kamoso uses gstreamer-1.0 and not gstreamer-0.10. 

For some reason gstreamer-1.0 does not have the plugin on my system (as shown by gst-inspect-1.0).
Comment 14 Lisa 2016-06-04 20:02:03 UTC
On Chakra, the bad plugins for gstreamer1.0 are also in their own package; once installed that, kamoso starts up without issues.

I have added the gst-plugins-bad package as a dependency of kamoso, other packagers should do the same for their distros (e.g. Archlinux).

Error handling inside kamoso could be improved, if there are no objections I'll send a patch for that later on.
Comment 15 Lisa 2016-06-04 21:27:43 UTC
Created attachment 99372 [details]
Shutting down gracefully at startup in case of missing plugin.

As promised, a patch for improved error handling. Let me know about it :)
Comment 16 Simon 2016-06-04 23:51:20 UTC
On Archlinux:
$sudo pacman -S gst-plugins-bad

On Ubuntu (in Mint and Debian the package name+ installation should be pretty much the same/similar):
$sudo apt-get install gstreamer0.10-plugins-bad 

On Fedora (not sure which one of these or maybe both):
$dnf install gstreamer-plugins-bad-free 
$dnf install gstreamer1-plugins-bad-free 

That should fix the not working kamoso.
Comment 17 Aleix Pol 2017-02-16 23:36:29 UTC
Thanks Lisa!

I'll apply the patch. Please next time use phabricator.kde.org to submit the patch.
Comment 18 Aleix Pol 2017-02-16 23:40:57 UTC
Git commit 1ff5f14fedd42bfa61ae181e0c598ec991ba4407 by Aleix Pol.
Committed on 16/02/2017 at 23:40.
Pushed by apol into branch '3.2'.

Gracefully exit when the pipeline can't be bootstraped

M  +5    -0    src/main.cpp
M  +13   -8    src/video/webcamcontrol.cpp
M  +2    -2    src/video/webcamcontrol.h

https://commits.kde.org/kamoso/1ff5f14fedd42bfa61ae181e0c598ec991ba4407