Motion-Project / motion

Motion, a software motion detector. Home page: https://motion-project.github.io/
GNU General Public License v2.0
3.69k stars 549 forks source link

Unable to grab image from camera, but reports connection is OK #1754

Closed tosiara closed 9 months ago

tosiara commented 9 months ago

Did you read the guide?

Yes

What is the base version number of Motion being used?

4.6.x

What was the install method?

Built from source code

What is base architecture?

ARM-32bit

What is the distro being used?

Ubuntu

Disto version number

22.04

Camera type(s) being used?

v4l2 USB camera

Describe the issue/problem and steps to reproduce

Once a month randomly one of my cameras stops motion detection and does not show stream. However the health monitoring script is unable to detect this state, because of motion reporting that camera is OK:

$ date
Thu Feb 22 10:12:12 AM EET 2024

$ curl localhost:8080/1/detection/connection
Camera cam0
Camera 1 -- cam0 Connection OK

However last log entries are from a day ago and actually contain errors:

[0:motion] [ERR] [ALL] [Feb 21 20:08:50] motion_watchdog: Thread 1 - Watchdog timeout. Trying to do a graceful restart
[0:motion] [ERR] [ALL] [Feb 21 20:09:00] motion_watchdog: Thread 1 - Watchdog timeout did NOT restart, killing it!
[0:st0] [ERR] [STR] [Feb 22 09:24:08] webu_stream_static: Could not get image to stream.
[0:st0] [ERR] [STR] Above message repeats 1 times
[0:st0] [ERR] [STR] [Feb 22 09:34:01] webu_stream_static: Could not get image to stream.
[0:st0] [ERR] [STR] [Feb 22 09:34:02] webu_stream_static: Could not get image to stream.

Uptime:

$ uptime
 10:18:33 up 2 days, 13:08,  1 user,  load average: 0.26, 0.37, 0.34

Dmesg shows no errors

Motion log output at log_level 8

[1:ml1:cam0] [NTC] [ALL] [Feb 21 18:24:01] mlp_actions: End of event 107
[1:ml1:cam0] [NTC] [ALL] [Feb 21 18:24:34] motion_detected: Motion detected - starting event 108.
[1:ml1:cam0] [NTC] [ALL] [Feb 21 18:24:34] mycreate_path: creating directory /home/motion/cam0
[1:ml1:cam0] [NTC] [EVT] [Feb 21 18:24:34] event_create_extpipe: pipe: x264 - --input-res 960x720 --fps 10 --crf 24 --preset ultrafast --quiet -o /home/motion/cam0/108-20240221_18-24.mp4
[1:ml1:cam0] [NTC] [EVT] [Feb 21 18:24:34] event_create_extpipe: cnt->moviefps: 10
[1:ml1:cam0] [NTC] [EVT] [Feb 21 18:24:34] event_newfile: Writing movie to file: /home/motion/cam0/108-20240221_18-24
[1:ml1:cam0] [NTC] [EVT] [Feb 21 18:25:48] event_newfile: Writing image to file: /home/motion/cam0/108-20240221_18-24.jpg
[1:ml1:cam0] [NTC] [EVT] [Feb 21 18:25:48] event_extpipe_end: CLOSING: extpipe file desc 10, error state 0
[1:ml1:cam0] [NTC] [EVT] [Feb 21 18:25:48] event_extpipe_end: pclose return: -1
[1:ml1:cam0] [NTC] [ALL] [Feb 21 18:25:48] mlp_actions: End of event 108
[1:ml1:cam0] [NTC] [ALL] [Feb 21 19:58:19] motion_detected: Motion detected - starting event 109.
[1:ml1:cam0] [NTC] [ALL] [Feb 21 19:58:19] mycreate_path: creating directory /home/motion/cam0
[1:ml1:cam0] [NTC] [EVT] [Feb 21 19:58:19] event_create_extpipe: pipe: x264 - --input-res 960x720 --fps 10 --crf 24 --preset ultrafast --quiet -o /home/motion/cam0/109-20240221_19-58.mp4
[1:ml1:cam0] [NTC] [EVT] [Feb 21 19:58:19] event_create_extpipe: cnt->moviefps: 10
[1:ml1:cam0] [NTC] [EVT] [Feb 21 19:58:19] event_newfile: Writing movie to file: /home/motion/cam0/109-20240221_19-58
[1:ml1:cam0] [NTC] [EVT] [Feb 21 20:08:18] event_extpipe_end: CLOSING: extpipe file desc 10, error state 0
[1:ml1:cam0] [NTC] [EVT] [Feb 21 20:08:20] event_extpipe_end: pclose return: -1
[1:ml1:cam0] [NTC] [ALL] [Feb 21 20:08:20] mycreate_path: creating directory /home/motion/cam0
[1:ml1:cam0] [NTC] [EVT] [Feb 21 20:08:20] event_create_extpipe: pipe: x264 - --input-res 960x720 --fps 10 --crf 24 --preset ultrafast --quiet -o /home/motion/cam0/109-20240221_20-08.mp4
[1:ml1:cam0] [NTC] [EVT] [Feb 21 20:08:20] event_create_extpipe: cnt->moviefps: 10
[1:ml1:cam0] [NTC] [EVT] [Feb 21 20:08:20] event_newfile: Writing movie to file: /home/motion/cam0/109-20240221_20-08
[0:motion] [ERR] [ALL] [Feb 21 20:08:50] motion_watchdog: Thread 1 - Watchdog timeout. Trying to do a graceful restart
[0:motion] [ERR] [ALL] [Feb 21 20:09:00] motion_watchdog: Thread 1 - Watchdog timeout did NOT restart, killing it!
[0:st0] [ERR] [STR] [Feb 22 09:24:08] webu_stream_static: Could not get image to stream.
[0:st0] [ERR] [STR] Above message repeats 1 times
[0:st0] [ERR] [STR] [Feb 22 09:34:01] webu_stream_static: Could not get image to stream.
[0:st0] [ERR] [STR] [Feb 22 09:34:02] webu_stream_static: Could not get image to stream.
[0:st0] [ERR] [STR] [Feb 22 10:09:41] webu_stream_static: Could not get image to stream.
[0:st0] [ERR] [STR] Above message repeats 1 times
[0:st0] [ERR] [STR] [Feb 22 10:11:00] webu_stream_static: Could not get image to stream.
[0:st0] [ERR] [STR] Above message repeats 1 times
[0:st0] [ERR] [STR] [Feb 22 10:11:08] webu_stream_static: Could not get image to stream.
Mr-Dave commented 9 months ago

The latest commit changes the watchdog a bit and should shutdown/restart cleaner and therefore allow for a correct status. If it still occurs, reopen. Also, do you know if the underlying cause is the camera or is it getting hung up on something related to the output file?