GNOME Bugzilla – Bug 618203
Cheese segfaults at startup
Last modified: 2011-09-27 20:55:42 UTC
Created attachment 160672 [details] strace output log When I run cheese, the window shows up with a "loading animation" when the cam view usually appears. Then it segfaults. It happenes always. Here's the backtrace from gdb: (gdb) file /usr/bin/cheese (gdb) run [Thread debugging using libthread_db enabled] [New Thread 0xb3c51b70 (LWP 14573)] [New Thread 0xb3450b70 (LWP 14574)] Program received signal SIGSEGV, Segmentation fault.
+ Trace 221826
Thread 3016039280 (LWP 14573)
Here's the peace of code responsible according to gdb: CheeseVideoFormat * cheese_camera_device_get_best_format (CheeseCameraDevice *device) { CheeseVideoFormat *format = g_boxed_copy (CHEESE_TYPE_VIDEO_FORMAT, cheese_camera_device_get_format_list (device)->data); GST_INFO ("%dx%d", format->width, format->height); return format; } Attached there's a strace log If you need more info, let me know.
Could you please attach a log created with the following command? GST_DEBUG=*cheese*:5 cheese > cheese.log 2>&1
Here you have $ cat cheese.log 0:00:00.508260900 1494 0x8927948 INFO cheese-device-monitor cheese-camera-device-monitor.c:231:cheese_camera_device_monitor_coldplug: Probing devices with udev... 0:00:00.521430846 1494 0x8927948 INFO cheese-device-monitor cheese-camera-device-monitor.c:121:cheese_camera_device_monitor_added: Checking udev device '/devices/pci0000:00/0000:00:03.1/usb3/3-1/3-1:1.0/video4linux/video0' 0:00:00.521681446 1494 0x8927948 INFO cheese-device-monitor cheese-camera-device-monitor.c:138:cheese_camera_device_monitor_added: Found device 046d:046d, getting capabilities... 0:00:05.704516188 1494 0x8927948 INFO cheese-camera-device cheese-camera-device.c:609:cheese_camera_device_get_caps_for_format: Getting caps for 0x0 0:00:05.704737800 1494 0x8927948 INFO cheese-camera-device cheese-camera-device.c:632:cheese_camera_device_get_caps_for_format: Got EMPTY
(In reply to comment #2) > Here you have > > $ cat cheese.log > 0:00:00.508260900 1494 0x8927948 INFO cheese-device-monitor > cheese-camera-device-monitor.c:231:cheese_camera_device_monitor_coldplug: > Probing devices with udev... > 0:00:00.521430846 1494 0x8927948 INFO cheese-device-monitor > cheese-camera-device-monitor.c:121:cheese_camera_device_monitor_added: Checking > udev device > '/devices/pci0000:00/0000:00:03.1/usb3/3-1/3-1:1.0/video4linux/video0' > 0:00:00.521681446 1494 0x8927948 INFO cheese-device-monitor > cheese-camera-device-monitor.c:138:cheese_camera_device_monitor_added: Found > device 046d:046d, getting capabilities... Uhm here we have a bug in the debugging code, it should print vendor:product not vendor:vendor, could you look for the exact vendor and product id from lsusb? > 0:00:05.704516188 1494 0x8927948 INFO cheese-camera-device > cheese-camera-device.c:609:cheese_camera_device_get_caps_for_format: Getting > caps for 0x0 > 0:00:05.704737800 1494 0x8927948 INFO cheese-camera-device > cheese-camera-device.c:632:cheese_camera_device_get_caps_for_format: Got EMPTY This is quite strange. Something is failing for sure on the device (or driver) side but we shouldn't handle the error state without failing this way. I have some idea about where we could be failing: cheese-camera-device.c:309 if ((msg == NULL) && (ret == GST_STATE_CHANGE_SUCCESS)) If this check fails (i.e. we're not able to run for some reason the pipeline who probes supported formats) we create a device with empty caps while we should error out. Would you be so kind to provide me a full gstreamer log? (same as before but with no cheese filter) GST_DEBUG=*:5 cheese > cheese.log 2>&1 And, does "gst-launch-0.10 v4l2src ! ffmpegcolorspace ! xvimagesink" work fine (i.e. does it turn on the camera and display the video stream)?
# lsusb -v [only webcam device] http://paste.pocoo.org/show/214154/ $ GST_DEBUG=*:5 cheese > cheese.log 2>&1 The output is 67M long!!! where should I upload it? do you prefer me to grep something specific from it? gst-launch-0.10 v4l2src ! ffmpegcolorspace ! xvimagesink" works fine :) In fact I've been able to use my webcam previously with cheese in Ubuntu. Now I'm using archlinux.
(In reply to comment #4) > # lsusb -v [only webcam device] > http://paste.pocoo.org/show/214154/ Thanks, so you have a 046d:08a2 Logitech, Inc. Labtec Webcam Pro, I will ask Hans for any known issues at driver level. > $ GST_DEBUG=*:5 cheese > cheese.log 2>&1 > The output is 67M long!!! where should I upload it? do you prefer me to grep > something specific from it? Try to "bzip2 -9" it (or probably even better lzma), here bzip2 can shrink a 150M log into a 4M file. Then you should be able to add it as an attachment here without encurring on any server limit. > gst-launch-0.10 v4l2src ! ffmpegcolorspace ! xvimagesink" works fine :) > > In fact I've been able to use my webcam previously with cheese in Ubuntu. Now > I'm using archlinux. Strange, maybe the webcam is just taking more time than expected to initialize, does it hang for some time (like 10 seconds or more) before displaying an image?
Ok, I found the origin of my problem, but the problem in cheese persist, as it shouldn't segfault. There's a problem of permission denied as a user. If I run this as user: $ gst-launch-0.10 v4l2src ! ffmpegcolorspace ! xvimagesink Setting pipeline to PAUSED ... ERROR: Pipeline doesn't want to pause. ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Could not open device '/dev/video0' for reading and writing. Additional debug info: v4l2_calls.c(502): gst_v4l2_open (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: system error: Permission denied Setting pipeline to NULL ... Freeing pipeline ... whereas if I run it as root, it works. Same happens with cheese. If I run it as root, it works. If not, it segfaults. So the problem is that I'm not in "video" group ;) But anyway, you should handle this permission error correctly, so let's try find where it crashes :)
Here's the cheese log compressed in lzma, now it is 1.9M :) http://espeweb.net/misc/tmp/cheese.log.lzma
(In reply to comment #6) > Ok, I found the origin of my problem, but the problem in cheese persist, as it > shouldn't segfault. > > There's a problem of permission denied as a user. If I run this as user: Great, this way I can easily reproduce it myself. It's failing exactly where I figured out it was :) Will try to write a fix and possibly roll a 2.30.2 bugfix release within a week or two (I'm quite busy right at the moment).
hehe great, hurray for us then! :D looking forward to the fix, but no rush, it's a busy time of year for lots of other people too :)
Filippo: were you able to write the fix for this in the end? :-)
I'm sorry, I should really stop promising things I'm almost sure I won't have the time to do :-P I will have some spare time starting from next Wednesday, will fix it in master. Is it worth a backport in 2.30 and a bugfix release at this point?
(In reply to comment #11) > I'm sorry, I should really stop promising things I'm almost sure I won't have > the time to do :-P Heh, I'm doing this all the time ;-) > I will have some spare time starting from next Wednesday, will fix it in > master. Is it worth a backport in 2.30 and a bugfix release at this point? If it's not too much work, I'd love to have a backport for 2.30. Not sure if a release would be useful -- I know I probably don't need one for openSUSE, but some other distros might prefer this. It really depends how critical you consider this bug, I guess.
The following fix has been pushed: f769ddc Do not create a device if gst initializazion fails
Created attachment 166232 [details] [review] Do not create a device if gst initializazion fails Currently we create a device with empty caps if the probing pipeline cannot be started. That's wrong, the device evidendtly doesn't work so the CheeseCameraDevice object for doesn't have to be created.
Committed on master and cherry-picked from gnome-2-30. We'll see if it's worth a release. Fixed the wrong product id issue pointed out in comment 3 too (both in master and in gnome-2-30).
Please ask for a string freeze break to commit this in the gnome-2-30 branch.
Claude, actually the string is not used anywhere at the moment and will never be for sure in 2.30, I'll remove it from translations.
Fine, thanks
Done, http://git.gnome.org/browse/cheese/commit/?h=gnome-2-30&id=a0b35f86822a6705dfc1ff88025bd5575959b261
*** Bug 631598 has been marked as a duplicate of this bug. ***