Motion segfaults while opening camera
Kernel 5.15.4-0-lts
, Alpine edge. Motion has trouble opening the camera device, and segfaults after a short time. The segfault happens after repeated requests to the stream server (http://127.0.0.1:8081/1/stream
in my case).
Dmesg excerpt (two separate crashes)
[ 275.649723] motion[2078]: segfault at 7f8a29cdabe8 ip 00007f8a2e7adbaa sp 00007ffe233baba8 error 6 in ld-musl-x86_64.so.1[7f8a2e771000+48000]
[ 275.649763] Code: 54 00 00 b8 10 00 00 00 0f 05 48 89 c7 e8 7b d1 fc ff 5a c3 0f be 0d 28 2d 04 00 85 c9 0f 84 a2 00 00 00 31 c0 ba 01 00 00 80 <f0> 0f b1 17 89 c2 85 c9 79 07 c6 05 08 2d 04 00 00 85 c0 0f 84 82
[ 405.609712] motion[2168]: segfault at 7f45bc8d7be8 ip 00007f45c13aabaa sp 00007ffcbbc04b18 error 6 in ld-musl-x86_64.so.1[7f45c136e000+48000]
[ 405.609744] Code: 54 00 00 b8 10 00 00 00 0f 05 48 89 c7 e8 7b d1 fc ff 5a c3 0f be 0d 28 2d 04 00 85 c9 0f 84 a2 00 00 00 31 c0 ba 01 00 00 80 <f0> 0f b1 17 89 c2 85 c9 79 07 c6 05 08 2d 04 00 00 85 c0 0f 84 82
Log from Motion
yuusen2:~# motion -n
[0:Unknown] [NTC] [ALL] conf_load: Processing thread 0 - config file /etc/motion/motion.conf
[0:Unknown] [NTC] [ALL] config_camera: Processing camera config file /etc/motion/camera1.conf
[0:Unknown] [NTC] [ALL] motion_startup: Logging to syslog
[0:Unknown] [NTC] [ALL] motion_startup: Motion 4.3.2 Started
[0:Unknown] [NTC] [ALL] motion_startup: Using default log type (ALL)
[0:Unknown] [NTC] [ALL] motion_startup: Using log type (ALL) log level (NTC)
[0:Unknown] [NTC] [STR] webu_start_strm: Starting all camera streams on port 8081
[0:Unknown] [NTC] [STR] webu_strm_ntc: Started camera 1 stream on port/camera_id 8081/1
[0:Unknown] [NTC] [STR] webu_start_ctrl: Starting webcontrol on port 8080
[0:Unknown] [NTC] [STR] webu_start_ctrl: Started webcontrol on port 8080
[0:Unknown] [NTC] [ENC] ffmpeg_global_init: ffmpeg libavcodec version 58.91.100 libavformat version 58.45.100
[0:Unknown] [NTC] [ALL] translate_init: Language: English
[0:Unknown] [NTC] [ALL] motion_start_thread: Camera ID: 1 is from /etc/motion/camera1.conf
[0:Unknown] [NTC] [ALL] motion_start_thread: Camera ID: 1 Camera Name: Hallway Device: /dev/video0
[0:Unknown] [NTC] [ALL] main: Waiting for threads to finish, pid: 2168
[1:Unknown] [NTC] [ALL] motion_init: Camera 1 started: motion detection Enabled
[1:Unknown] [NTC] [VID] vid_start: Opening V4L2 device
[1:Unknown] [NTC] [VID] v4l2_device_open: Using videodevice /dev/video0 and input -1
[1:Unknown] [NTC] [VID] v4l2_device_capability: - VIDEO_CAPTURE
[1:Unknown] [NTC] [VID] v4l2_device_capability: - READWRITE
[1:Unknown] [NTC] [VID] v4l2_device_capability: - STREAMING
[1:Unknown] [NTC] [VID] v4l2_input_select: Name = "ov534"- CAMERA
[1:Unknown] [NTC] [VID] v4l2_norm_select: Device does not support specifying PAL/NTSC norm
[1:Unknown] [NTC] [VID] v4l2_pixfmt_select: Configuration palette index 17 (YU12) for 640x480 doesn't work.
[1:Unknown] [NTC] [VID] v4l2_pixfmt_select: Supported palettes:
[1:Unknown] [NTC] [VID] v4l2_pixfmt_select: (0) GRBG (8-bit Bayer GRGR/BGBG)
[1:Unknown] [NTC] [VID] v4l2_pixfmt_select: (1) YUYV (YUYV 4:2:2)
[1:Unknown] [NTC] [VID] v4l2_pixfmt_set: Testing palette YUYV (640x480)
[1:Unknown] [NTC] [VID] v4l2_pixfmt_set: Using palette YUYV (640x480)
[1:Unknown] [NTC] [VID] v4l2_pixfmt_select: Selected palette YUYV
[1:Unknown] [NTC] [ALL] image_ring_resize: Resizing pre_capture buffer to 1 items
[0:Unknown] [ERR] [ALL] motion_watchdog: Thread 1 - Watchdog timeout. Trying to do a graceful restart
[0:Unknown] [ERR] [ALL] motion_watchdog: Thread 1 - Watchdog timeout did NOT restart, killing it!
SIGVTALRM went off
[1:Unknown] [ERR] [VID] v4l2_capture: VIDIOC_DQBUF: Interrupted system call
Segmentation fault
Afterwards, the camera device (1415:2000 OmniVision Technologies, Inc. USB Camera-B4.09.24.1
- ps3 eyecam) stops working until reboot ERROR: cannot read `/dev/video0' (Resource temporarily unavailable)
.
Configuration Files
/etc/motion/motion.conf
daemon on
setup_mode off
log_level 6
webcontrol_port 8080
webcontrol_localhost off
stream_port 8081
stream_localhost off
stream_maxrate 15
camera /etc/motion/camera1.conf
# Type of configuration options to allow via the webcontrol.
webcontrol_parms 0
movie_output off
/etc/motion/camera1.conf
camera_name Hallway
camera_id 1
videodevice /dev/video0
rotate 270
width 640
height 480
framerate 15
# Text to be overlayed in the lower left corner of images
text_left Hallway
# Text to be overlayed in the lower right corner of images.
text_right %Y-%m-%d\n%T-%q