BUG: Network error for a single netcam thread causes motion to quit everything.
I run motion with multiple network cameras. At startup, if one of my cameras refuses a network connection then motion quits.
This behavior is not good for an automated environment (e.g. motion could just try that thread again later).
Test case
I've set up three Panasonic Network cameras configured in three thread files. The last one (3) is wireless, and sometimes has network errors.
Here are the relevant lines from /var/log/messages:
Feb 2 13:45:09 cpe1 motion: Netcam: thread 1: starting...
Feb 2 13:45:09 cpe1 motion: Netcam: thread 2: starting...
Feb 2 13:45:09 cpe1 motion: Netcam: thread 3: starting...
Feb 2 13:45:09 cpe1 motion: Netcam: can't connect to server
Feb 2 13:45:09 cpe1 motion: Capture error Connection refused
Here is the output from motion:
Processing thread 0 - config file motion.conf
Processing thread 1 - config file /usr/config/camera1.properties
Processing thread 2 - config file /usr/config/camera2.properties
Processing thread 3 - config file /usr/config/camera3.properties
Webcam port for thread 1 is 0
Webcam port for thread 2 is 0
Webcam port for thread 3 is 0
Thread1 device: http://192.168.254.53:10053/SnapshotJpeg?Resolution=320x240&Quality=Standard input: -1
Netcam: thread 1: starting...
Thread2 device: http://192.168.254.51:10051/SnapshotJpeg?Resolution=320x240&Quality=Standard input: -1
Thread3 device: http://192.168.254.52:10052/SnapshotJpeg?Resolution=320x240&Quality=Standard input: -1
Netcam: thread 2: starting...
Netcam: thread 3: starting...
Netcam: can't connect to server
[it then quits the entire motion process]
Environment
Motion version: |
3.1.18 |
ffmpeg version: |
0.4.8 |
Shared libraries: |
curl, xmlrpc, ffmpeg |
Server OS: |
Linux 2.4.21-20.EL |
--
BruceDurham - 03 Feb 2005
Follow up
That seems a bug , only the thread that fails should finish . That happens in the first call to vid_start() and if it fails motion exit or when a fatal error happens in netcam_next() ( Timeout Connection , Timeout Reconnection , Too many failures in Frames , etc ...).
--
AngelCarpintero - 03 Feb 2005
I've ready a patch to solve your problem , i'll release as soon as i verify that hasn't race condictions.
--
AngelCarpintero - 06 Feb 2005
Fix record
Fixed with
post-3 patch , reopen if errors remains.
--
AngelCarpintero - 08 Feb 2005
Fix is included in 3.1.19.
There is a similar newer bug which is still open at the time this is closed.
http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2005x03x06x023010
--
KennethLavrsen - 10 Mar 2005
The bug still exists in 3.1.19
I'm using 3 Panasonic (KX-HCM280, KX-HCM270, BL-C10A) netcams and one Toshiba IK-WB01A netcam; It's reporting that the Toshiba is not a JPEG image (even though the URL returns a JPEG image in IE and Firefox).
--
BruceDurham - 28 Mar 2005
After further testing I've definitely narrowed it down to the Toshiba IK-WB01A. If it's used, motion crashes; otherwise everything is ok. I've uploaded the output from mjpegsnif of this camera; There appear to be ctl-M's (carriage-return, CR) in the header info; could this be the problem?
--
BruceDurham - 12 Apr 2005