Page 1 of 1

0 Events on Certain Cameras

Posted: Tue Dec 20, 2005 5:15 pm
by Ruler
I've got a weird problem on an older ZM box. It's running 1.19.5 and is set to purge unarchived events when the disk free space is greater than 97%, limited to the first 100 matches and sorted by date/time in ascending order. All monitors record continually in 5 minute chunks. It's been running fine with this configuration since I installed it over a year ago. I noticed that today, two cameras (monitors 1 and 5) have 0 events for the hour, day, and week, but have 1700-1800 events for the month vs 12, 280, 2000, and 4200 events respectively.

I discovered the following in zmaudit.log:

Code: Select all

DBD::mysql::st execute failed: Got error 134 from table handler at /usr/local/bin/zmaudit.pl line 278.
Can't execute: Got error 134 from table handler at /usr/local/bin/zmaudit.pl line 278.
Found orphaned frame records for event 1792654, deleting.
This is repeating many, many, many times.

I looked in zmaudit.pl and line 278 is:

Code: Select all

$res = $sth5->execute( $frame->{EventId} ) or die( "Can't execute: ".$sth6->errstr() );

I'm guessing that an event won't delete and is blocking the process from continuing, but this is just a preliminary hypothesis. Has anybody encountered something like this in the before?

Posted: Tue Dec 20, 2005 5:20 pm
by jameswilson
not sure if its related but i know there was an issue with pre 1.21.3 zmaudit deleting things it shouldnt. I noticed this os i always use mocord/record and had different event counts for different monitors, but not to the extent of them all for an hour, just 1 or 2. Phil fixed this in 1.21.3

James

Posted: Tue Dec 20, 2005 5:35 pm
by Ruler
I'm aware of and have been impacted by that bug before, but it's always been a very few events and didn't discriminate based on camera. Given the error listed in zmaudit.log, I'm guessing that it's something else.

I also checked through the web interface and found that event 1792654 does not exist.

Posted: Tue Dec 20, 2005 5:40 pm
by jameswilson
i suppose if it was mine id do a mysqlcheck just to check the db hasnt an issue with corrution somewhere but i assume you have tried that.

The only other time i see 0 events if when using detection on mocord and its always in alarm. It only seems to stop the event and create a new one when the alarm stops, this has caused me prob on ptz cams on tour and when i have set the detection up wrong. But i think you said you were on record so it cant be that either.

Posted: Tue Dec 20, 2005 5:56 pm
by Ruler
Found the problem. I did a check table from the mysql console for each of the tables in the zoneminder database and discovered that several tables had problems. The worst was the Events table:

Code: Select all

check warning Table is marked as crashed.
check warning 11 clients are using or haven't closed the table properly.
check warning Found 67080 keys of 67088.
check error Corrupt.
I had to manually kill each ZM task that was running, as neither the web stop command nor the startup script would work. I then did a repair table command on each of the tables that reported errors. (Events, Filters, Frames, and Users.) The Frames table reported that the number of rows changed from 739370 to 739353 when I did, but that was the only problem. They all checked out fine after that, so I started ZM back up.

Lo and behold, the two cameras that had 0 events now have 2 each. :) I can't believe I didn't think to check the database for corruption... Still very strange that the corruption would have the effect that it did though.

Posted: Tue Dec 20, 2005 5:59 pm
by Ruler
GMTA James - I must've been typing the solution when you submitted your last post. :) Believe it or not, my last post (regarding something else having to be the problem) made me think to check the tables out.

Posted: Tue Dec 20, 2005 6:20 pm
by jameswilson
glad its sorted one way or tother mate.
I cron a mysql every day just in case now as i have had corruption from something before, i assume bad power downs

Posted: Tue Dec 20, 2005 10:27 pm
by zoneminder
Yes. DB errors can be nasty. I am living on a knife edge at the moment as the disk I develop on has developed disk errors and I don't have space for a new one. So as various files track across the bad sectors they get mangled. My Frames table got eaten up last week. An Xmas break task is to try and migrate everything off it before it goes completely :lol:

Phil