I am running ZM .9.15 on a Debian distribution with kernel version 2.4.20.
I have not tried .16 yet but I believe this applies to it as well.
I start ZM at boot using the included zm script installed
into /etc/init.d.
I recently built a filter to automatically archive certain events.
Whenever I booted my system, the zmfilter daemon would
crash every few seconds, only to be restarted immediately
by the zmdc daemon. This would continue until I recycled
ZM. Everything would be fine until the next boot.
I think I have found the problem at line 198 in zmfilter.pl.
my $shmid = shmget( $key, $size, 0 ) || die( "Can't get shared memory id: $!" );
Here is the result of ipcs after a boot and start of ZM:
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x7a6d2010 0 www-data 700 11520248 2
0x7a6d2005 32769 www-data 700 11520248 1
0x7a6d2008 65538 www-data 700 11520248 2
0x00000000 98307 root 600 196608 2
0x00000001 131076 root 600 655360 2
0x00000000 163845 root 644 790528 2 dest
Notice that the shmid for the first segment is 0.
The left side of line 198 resolves to 0. The logical OR
considers this false and the script dies.
Here is the result of ipcs after recycling ZM:
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x7a6d2010 196608 www-data 700 11520248 2
0x7a6d20052 29377 www-data 700 11520248 1
0x7a6d2008 262146 www-data 700 11520248 2
0x00000000 98307 root 600 196608 2
0x00000001 131076 root 600 655360 2
0x00000000 163845 root 644 790528 2 dest
No more shmid=0 and no more problem.
I changed line 198 to this:
(my $shmid = shmget( $key, $size, 0 )) >=0 || die( "Can't get shared memory id: $!" );
Shmget returns a -1 if it fails. Anything greater is acceptable,
Hope this helps someone else.
Looking forward to .16
Tom
Tom
zmfilter daemon crashing
- zoneminder
- Site Admin
- Posts: 5215
- Joined: Wed Jul 09, 2003 2:07 pm
- Location: Bristol, UK
- Contact:
Re: zmfilter daemon crashing
Hi Tom,
I believe your problem is one that has been fixed in .16, did you find zmfilter turned into a bit of a CPU hog after the error?
Phil
I believe your problem is one that has been fixed in .16, did you find zmfilter turned into a bit of a CPU hog after the error?
Phil