Motion - Bug Report 2008x 05x 29x 082232
You are here: Foswiki>Motion Web>BugReports>BugReport2008x05x29x082232 (02 Jun 2008, AngelCarpintero)Edit Attach

BUG: Crash on reconect webcam

When I lost the connection on my webcam Logitech, unplug and plug the usb, then Motion detect the camera again and is going down.

Webcam Logitech Quickcam express with module quickcam

Output message log

15:53:30 motion: [2] Retrying until successful connection with camera
15:53:30 motion: [2] Failed to open video device /dev/video0: No such device
15:53:40 motion: [2] Retrying until successful connection with camera
15:53:40 motion: [2] Failed to open video device /dev/video0: No such device
15:53:50 motion: [2] Retrying until successful connection with camera
15:53:50 motion: [2] Failed to open video device /dev/video0: No such device
15:53:58 kernel: usb 1-8: new full speed USB device using ohci_hcd and address
12
15:53:59 kernel: usb 1-8: new device found, idVendor=046d, idProduct=0870
15:53:59 kernel: usb 1-8: new device strings: Mfr=0, Product=1, SerialNumber=0
15:53:59 kernel: usb 1-8: Product: Camera
15:53:59 kernel: usb 1-8: configuration #1 chosen from 1 choice
15:53:59 kernel: quickcam: QuickCam USB camera found (driver version QuickCam
USB 0.6.6 $Date: 2006/11/04 08:38:14 $)
15:53:59 kernel: quickcam: bus:1 class:FF subclass:FF vendor:046D product:0870
15:53:59 kernel: quickcam: Sensor HDCS-1020 detected
15:53:59 kernel: motion[15923]: segfault at ffffffff0958d0c8 rip
000000000041da22 rsp 00000000407fe970 error 4

Environment

Motion version: 3.2.10
ffmpeg version: FFmpeg version SVN-r12823
Shared libraries: ffmpeg, mysql, postgresql
Server OS: Opensuse 10.3 64bits, kernel 2.6.22.17-0.1-default

-- TrebolA - 29 May 2008

Follow up

Hi Alberto,

I run motion in no daemon mode in a x86 and i cannot reproduce your issue :

motion
[1] mcapture error in proc 17341: No such device
[1] Video device fatal error - Closing video device
[1] Closing video device /dev/video3
[1] Retrying until successful connection with camera
[1] Failed to open video device /dev/video3: No such file or directory
[1] Retrying until successful connection with camera
[1] Failed to open video device /dev/video3: No such file or directory
[1] Retrying until successful connection with camera
[1] Failed to open video device /dev/video3: No such file or directory
[1] Video signal lost - Adding grey image
[1] Retrying until successful connection with camera
[1] Failed to open video device /dev/video3: No such file or directory
[1] Retrying until successful connection with camera
[1] Failed to open video device /dev/video3: No such file or directory
[1] Retrying until successful connection with camera
[1] Failed to open video device /dev/video3: No such file or directory
[1] Retrying until successful connection with camera
[1] Not a V4L2 device?
[1] Failed with YUV420P, trying YUV422 palette: Invalid argument
[1] Using VIDEO_PALETTE_YUV422 palette
[1] Using V4L1
[1] Video signal re-acquired

syslog
May 29 14:36:55 develop4 kernel: [389191.024603] usb 2-4: USB disconnect, address 3
May 29 14:36:55 develop4 NetworkManager: <debug> [1212064615.134103] nm_hal_device_removed(): Device removed 
(hal udi is '/org/freedesktop/ Hal/devices/usb_device_46d_870_noserial_if0').
May 29 14:36:55 develop4 NetworkManager: <debug> [1212064615.139509] nm_hal_device_removed(): Device removed 
(hal udi is '/org/freedesktop/ Hal/devices/usb_device_46d_870_noserial').
May 29 14:36:55 develop4 motion: [1] mcapture error in proc 17341: No such device
May 29 14:36:55 develop4 motion: [1] Video device fatal error - Closing video device
May 29 14:36:55 develop4 motion: [1] Closing video device /dev/video3
May 29 14:37:00 develop4 motion: [1] Retrying until successful connection with camera
May 29 14:37:00 develop4 motion: [1] Failed to open video device /dev/video3: No such file or directory
May 29 14:37:10 develop4 motion: [1] Retrying until successful connection with camera
May 29 14:37:10 develop4 motion: [1] Failed to open video device /dev/video3: No such file or directory
May 29 14:37:20 develop4 motion: [1] Retrying until successful connection with camera
May 29 14:37:20 develop4 motion: [1] Failed to open video device /dev/video3: No such file or directory
May 29 14:37:25 develop4 motion: [1] Video signal lost - Adding grey image
May 29 14:37:30 develop4 motion: [1] Retrying until successful connection with camera
May 29 14:37:30 develop4 motion: [1] Failed to open video device /dev/video3: No such file or directory
May 29 14:37:40 develop4 motion: [1] Retrying until successful connection with camera
May 29 14:37:40 develop4 motion: [1] Failed to open video device /dev/video3: No such file or directory
May 29 14:37:50 develop4 motion: [1] Retrying until successful connection with camera
May 29 14:37:50 develop4 motion: [1] Failed to open video device /dev/video3: No such file or directory
May 29 14:37:59 develop4 kernel: [389254.834838] usb 2-4: new full speed USB device using ohci_hcd and address 4
May 29 14:37:59 develop4 kernel: [389255.043677] usb 2-4: configuration #1 chosen from 1 choice
May 29 14:37:59 develop4 NetworkManager: <debug> [1212064679.248975] nm_hal_device_added(): 
New device added (hal udi is '/org/freedesktop/ Hal/devices/usb_device_46d_870_noserial').
May 29 14:37:59 develop4 kernel: [389255.051485] quickcam: QuickCam USB camera found 
(driver version QuickCam USB 0.6.6 $Date: 2006/11/04   08:38:14 $)
May 29 14:37:59 develop4 kernel: [389255.051495] quickcam: Kernel:2.6.24-16-generic bus:2 
class:FF subclass:FF vendor:046D product:0870
May 29 14:37:59 develop4 kernel: [389255.074468] quickcam: Sensor HDCS-1020 detected
May 29 14:37:59 develop4 kernel: [389255.080516] quickcam: Registered device: /dev/video3
May 29 14:37:59 develop4 NetworkManager: <debug> [1212064679.385791] nm_hal_device_added():
 New device added (hal udi is '/org/freedesktop/ Hal/devices/usb_device_46d_870_noserial_if0').
May 29 14:38:00 develop4 motion: [1] Retrying until successful connection with camera
May 29 14:38:00 develop4 motion: [1] Not a V4L2 device?
May 29 14:38:00 develop4 motion: [1] Failed with YUV420P, trying YUV422 palette: Invalid argument
May 29 14:38:00 develop4 motion: [1] Using VIDEO_PALETTE_YUV422 palette
May 29 14:38:00 develop4 motion: [1] Video signal re-acquired

I'll try to reproduce in x84_64 .

-- AngelCarpintero - 29 May 2008

Hi Angel,

Note: When motion lost the connection with webcam, the device is not dissapear, the /dev/video0 still exists. (I think i have problem with the usb cable (5 mts) or the humidity on webcam)

I have launch Motion on mode no-daemon and this is the console messages:
[0] Thread 2 - Watchdog timeout, did NOT restart graceful,killing it!
[0] Calling vid_close() from motion_cleanup
[0] Closing video device /dev/video0
[0] Motion thread 2 restart
[2] Thread 2 started
[2] Not a V4L2 device?
[2] Failed with YUV420P, trying YUV422 palette: Invalid argument
[2] Using VIDEO_PALETTE_YUV422 palette
[2] Using V4L1
[2] Resizing pre_capture buffer to 1 items
[0] Thread 2 - Watchdog timeout, trying to do a graceful restart
[0] Thread 2 - Watchdog timeout, did NOT restart graceful,killing it!
[0] Calling vid_close() from motion_cleanup
[0] Closing video device /dev/video0
[0] Motion thread 2 restart
[2] Thread 2 started
[2] Not a V4L2 device?
[2] Failed with YUV420P, trying YUV422 palette: Invalid argument
[2] Using VIDEO_PALETTE_YUV422 palette
[2] Using V4L1
[2] Resizing pre_capture buffer to 1 items
[0] Thread 2 - Watchdog timeout, trying to do a graceful restart
[2] Started stream webcam server in port 8891
[2] Thread exiting
[2] Calling vid_close() from motion_cleanup
[2] Closing video device /dev/video0
Violación de segmento
trebol-a:~/>

and messages log:
May 29 19:17:38 kernel: usb 1-8: USB disconnect, address 18
May 29 19:17:43 motion: [0] Thread 2 - Watchdog timeout, trying to do a graceful restart
May 29 19:17:45 kernel: usb 1-8: new full speed USB device using ohci_hcd and address 19
May 29 19:17:45 kernel: usb 1-8: new device found, idVendor=046d, idProduct=0870
May 29 19:17:45 kernel: usb 1-8: new device strings: Mfr=0, Product=1, SerialNumber=0
May 29 19:17:45 kernel: usb 1-8: Product: Camera
May 29 19:17:45 kernel: usb 1-8: configuration #1 chosen from 1 choice
May 29 19:17:45 kernel: quickcam: QuickCam USB camera found (driver version QuickCam USB 0.6.6 $Date: 2006/11/04 08:38:14 $)
May 29 19:17:45 kernel: quickcam: bus:1 class:FF subclass:FF vendor:046D product:0870
May 29 19:17:45 kernel: quickcam: Sensor HDCS-1020 detected
May 29 19:17:46 motion: [2] Started stream webcam server in port 8891
May 29 19:17:46 motion: [2] Calling vid_close() from motion_cleanup
May 29 19:17:46 motion: [2] Closing video device /dev/video0
May 29 19:17:46 kernel: quickcam: frame lost
May 29 19:17:46 kernel: quickcam: frame lost
May 29 19:17:47 kernel: motion[11805]: segfault at 00002aaaaaaab000 rip 000000000040cae2 rsp 000000006f05b878 error 4
May 29 19:17:47 kernel: motion[11247]: segfault at 00002aaaaaaab000 rip 000000000040cae2 rsp 000000006e059878 error 4
May 29 19:17:47 kernel: motion[11246]: segfault at 00002aaaaaaab000 rip 000000000040cae2 rsp 000000006d858878 error 4
May 29 19:17:47 kernel: motion[10588]: segfault at 00002aaaaaaab000 rip 000000000040cae2 rsp 000000006a051878 error 4
May 29 19:17:47 kernel: motion[10025]: segfault at 00002aaaaaaab000 rip 000000000040cae2 rsp 000000006804d878 error 4
May 29 19:17:48 kernel: motion[11032]: segfault at 00002aaaaaaab000 rip 000000000040cae2 rsp 000000006b053878 error 4
May 29 19:17:48 kernel: quickcam: Control URB error -2
 

-- TrebolA - 29 May 2008

Alberto , lets try to get a coredump from motion and use gdb to get some clues :

ulimit -c  50000
make distclean   
./configure --without-optimizecpu --with-developer-flags

edit Makefile and remove -O2
sed -i 's/-O2//g' Makefile
make 
Run motion then when you get a core file run gdb :
gdb ./motion core ( or core.1231 , 1231 is the pid file of motion ) 

(gdb) info threads
(gdb) bt full
(gdb) frame n ( n is the frame where segfault happened )
 

-- AngelCarpintero - 01 Jun 2008


I've a patch to avoid motion segfault ( it only happen in x86_64 ) but i'm not sure if it's a good solution , while i've been testing the patch i got a lot of kernel oops

because qc-usb 0.6.6 using V41L is very buggy so better keep motion segfaulting that have to restart you computer . I tried with other webcam using V4L2 ( no need any patch ) and pwc using V4L1 patch works. So let me know if you want to test this workaround .

-- AngelCarpintero - 02 Jun 2008


I've insolated the kernel oops , it only happen if you have any usb bus issue. So if you want to test my path and check that you problem is solved apply the attached patch , get svn copy of motion-3.2.10 branch better .
svn co http://www.lavrsen.dk/svn/motion/branches/3.2.10/  3.2.10
cd  3.2.10/

get the patch and apply
patch <  v4l1-x86_64.diff

-- AngelCarpintero - 02 Jun 2008

Fix record

Topic revision: r6 - 02 Jun 2008, AngelCarpintero
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Please do not email Kenneth for support questions (read why). Use the Support Requests page or join the Mailing List.
This website only use harmless session cookies. See Cookie Policy for details. By using this website you accept the use of these cookies.