After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 618203 - Cheese segfaults at startup
Cheese segfaults at startup
Status: RESOLVED FIXED
Product: cheese
Classification: Applications
Component: general
2.30.x
Other Linux
: Normal blocker
: 2.28
Assigned To: Cheese Maintainer(s)
Cheese Maintainer(s)
: 631598 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2010-05-09 20:51 UTC by Pau Espin Pedrol
Modified: 2011-09-27 20:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
strace output log (278.75 KB, text/plain)
2010-05-09 20:51 UTC, Pau Espin Pedrol
  Details
Do not create a device if gst initializazion fails (2.60 KB, patch)
2010-07-20 18:43 UTC, Filippo Argiolas
committed Details | Review

Description Pau Espin Pedrol 2010-05-09 20:51:47 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.

Thread 3016039280 (LWP 14573)

  • #0 cheese_camera_device_get_best_format
    at cheese-camera-device.c line 592
  • #1 cheese_camera_play
    at cheese-camera.c line 752
  • #2 setup_camera
    at cheese-widget.c line 344
  • #3 g_thread_create_proxy
    from /usr/lib/libglib-2.0.so.0
  • #4 start_thread
    from /lib/libpthread.so.0
  • #5 clone
    from /lib/libc.so.6




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.
Comment 1 Filippo Argiolas 2010-05-13 10:00:09 UTC
Could you please attach a log created with the following command?

GST_DEBUG=*cheese*:5 cheese > cheese.log 2>&1
Comment 2 Pau Espin Pedrol 2010-05-14 09:55:55 UTC
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
Comment 3 Filippo Argiolas 2010-05-14 10:16:35 UTC
(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)?
Comment 4 Pau Espin Pedrol 2010-05-15 01:37:40 UTC
# 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.
Comment 5 Filippo Argiolas 2010-05-15 06:42:37 UTC
(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?
Comment 6 Pau Espin Pedrol 2010-05-15 13:22:34 UTC
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 :)
Comment 7 Pau Espin Pedrol 2010-05-15 13:33:30 UTC
Here's the cheese log compressed in lzma, now it is 1.9M :)
http://espeweb.net/misc/tmp/cheese.log.lzma
Comment 8 Filippo Argiolas 2010-05-16 17:38:13 UTC
(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).
Comment 9 Pau Espin Pedrol 2010-05-17 01:03:46 UTC
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 :)
Comment 10 Vincent Untz 2010-07-19 06:24:33 UTC
Filippo: were you able to write the fix for this in the end? :-)
Comment 11 Filippo Argiolas 2010-07-19 06:37:20 UTC
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?
Comment 12 Vincent Untz 2010-07-19 06:46:26 UTC
(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.
Comment 13 Filippo Argiolas 2010-07-20 18:43:09 UTC
The following fix has been pushed:
f769ddc Do not create a device if gst initializazion fails
Comment 14 Filippo Argiolas 2010-07-20 18:43:14 UTC
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.
Comment 15 Filippo Argiolas 2010-07-20 18:57:44 UTC
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).
Comment 16 Claude Paroz 2010-07-20 19:07:12 UTC
Please ask for a string freeze break to commit this in the gnome-2-30 branch.
Comment 17 Filippo Argiolas 2010-07-20 19:21:38 UTC
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.
Comment 18 Claude Paroz 2010-07-20 19:25:48 UTC
Fine, thanks
Comment 20 David King 2011-09-27 20:55:42 UTC
*** Bug 631598 has been marked as a duplicate of this bug. ***