Syslog Event Patch
Introduction
This patch addresses the issue that Motion starts processes that never ends
Patch was submitted by Mike Lees on the Motion Mailing List on 1st of October 2004
Description of Patch
This is Mike's email
After going round in circles for a few hours I think I have tracked down the
source of the problem.
I think it is due to syslog() not being reentrant. syslog was introduced in
3.1.9 and the latest version that doesn't exhibit the problem is 3.1.8. The
only other evidence I can point to is a Postgres issue from last July:
http://archives.postgresql.org/pgsql-admin/2003-07/msg00339.php
I am not sure that this initial patch will completely fix the problem and I
will explain why:
The change I have made makes the parent process call syslog rather than the
child process but only for the cases where the "on" scripts are being called
(and also send email and send sms). What concerns me is the potential
problems due to the other threads that make up motion - will problems occur
in systems with 16 cameras?
I think it would be useful to have an option so that motion could run with
different levels of logging. Most of the time I would be happy for just
errors to be logged. I'd be happy to implement this if people will find it
useful.
I would appreciate it if anyone who is having problems could test out my
patch.
To apply the patch:
$ cd ....../motion-3.1.16
$ zcat ..../patch.gz | patch -p1
and then rebuild.
Regards,
Mike.
Installation of Patch
I have uploaded the patch uncompressed.
So the installation of it is
patch -P1 < syslog_event.patch
The patch should remove an additional line to work.
I have implemented it in the 3.1.17 sources but commented out the 3 syslog debug related parts. Additionally the syslog message that report motion detected and how many pixels detected has been commented out.
This all for two reasons. The lack of being fully reentrant makes syslog something you only call when there are errors and during startup of a program.
2nd there is no need to add additional load for nothing. Noone has reported any good use of these 4 debug messages that ends up as many MBs of data in your log if DEBUG mode logging is turned on or you have a user log.
--
KennethLavrsen - 01 Oct 2004
Kenneth,
I'm still getting a lot of zombie processes from onsave and onmpeg when I run motion 3.1.17 in daemon (-D) mode. Here are a few examples from my 'ps -ef'
bruce 13341 11891 0 18:44 ? 00:00:00 [onsave.sh ]
bruce 13427 11891 0 18:45 ? 00:00:00 [onsave.sh ]
bruce 13493 11891 0 18:46 ? 00:00:00 [onsave.sh ]
bruce 13722 11891 0 18:48 ? 00:00:00 [onsave.sh ]
bruce 13814 11891 0 18:49 ? 00:00:00 [onmpeg.sh ]
bruce 13816 11891 0 18:49 ? 00:00:00 [onsave.sh ]
.
.
.
bruce 26191 11891 0 21:00 ? 00:00:00 [onsave.sh ]
bruce 26630 11891 0 21:05 ? 00:00:00 [onsave.sh ]
bruce 26726 11891 0 21:06 ? 00:00:00 [onmpeg.sh ]
bruce 26728 11891 0 21:06 ? 00:00:00 [onsave.sh ]
My scripts only do string manipulation and save the result to a file; I'm running: Linux 2.4.21-15.0.4.EL #1 Sat Jul 31 01:33:50 EDT 2004 i686 i686 i386 GNU/Linux
-brucedur@pacbell.net
p.s. Sorry about the duplication; I posted this in the general area mistakenly.
--
BruceDurham - 17 Oct 2004