I've set the warm up frames to match the pre-event frames, so I capture everything after the process is restarted, but it means I miss any frames from before the event was triggered. In the above case the event lasted long enough to trigger a new alarm after the process had restarted, but some very short events are missed completely.08:55:49 zma_m1[14191]: INF [1: 25000 - Processing at 4.17 fps]
08:57:50 zma_m1[14191]: INF [1: 25508 - Gone into prealarm state]
08:57:51 zma_m1[14191]: INF [1: 25509 - Gone into alarm state]
08:57:51 zma_m1[14191]: INF [1: 25509 - Opening new event 8675, alarm start]
08:58:00 zma_m1[14191]: INF [1: 25546 - Gone into alert state]
08:58:01 zma_m1[14191]: INF [1: 25553 - Gone back into alarm state]
Above 2 lines repeat 3 more times
08:58:17 zmc_dvideo0[]: INF [1: 563000 - Capturing at 4.17 fps]
08:58:17 zma_m1[14191]: INF [1: 25620 - Gone into alert state]
08:58:27 zma_m1[14191]: INF [1: 25660 - Left alarm state (8675) - 167(62) images]
08:58:27 zma_m1[14191]: INF [1: 25660 - Closing event 8675, alarm end]
...
18:07:41 zma_m1[14191]: INF [1: 163000 - Processing at 4.17 fps]
18:07:44 zma_m1[14191]: INF [1: 163009 - Gone into prealarm state]
18:07:44 zma_m1[14191]: INF [1: 163010 - Gone into alarm state]
18:07:44 zma_m1[14191]: ERR [Can't insert event: MySQL has gone away]
18:07:44 zmdc [03904]: ERR ['zma -m 1' exited abnormally, exit status 214]
18:07:44 zmdc [03904]: INF [Starting pending process, zma -m 1]
18:07:44 zmdc [03904]: INF ['zma -m 1' starting at 12/02/22 18:07:44, pid = 25276]
18:07:44 zmdc [25276]: INF ['zma -m 1' started at 12/02/22 18:07:44]
18:07:44 zma_m1[25276]: INF [Debug Level = 0, Debug Log = <none>]
18:07:44 zma_m1[25276]: INF [In mode 3/1, warming up]
18:07:48 zma_m1[25276]: INF [1: 016 - Gone into prealarm state]
18:07:48 zma_m1[25276]: INF [1: 017 - Gone into alarm state]
18:07:48 zma_m1[25276]: INF [1: 017 - Opening new event 8677, alarm start]
18:07:48 zma_m1[25276]: INF [1: 019 - Gone into alert state]
18:07:49 zma_m1[25276]: INF [1: 020 - Gone back into alarm state]
Above 2 lines repeat 4 more times
18:08:02 zma_m1[25276]: INF [1: 077 - Gone into alert state]
18:08:12 zma_m1[25276]: INF [1: 117 - Left alarm state (8677) - 116(33) images]
18:08:12 zma_m1[25276]: INF [1: 117 - Closing event 8677, alarm end]
I'm running Debian stable (6.0) with the packaged ZoneMinder 1.24.2 and the packaged MySQL 5.1.49
I couldn't find any reference to ZoneMinder and the MySQL connection timeout. I searched the documentation, FAQ, Forum and internet generally. I did find several examples of people listing the error in their logs, but only one thread addressed the error, and the follow up question was about the spec of the server. To answer that: The server is a dual Pentium D 2.80GHz with 4 GB RAM. The load average around an event is 0.14, 0.06, 0.01. The thread didn't go any further.
Some searching on the internet indicates that MySQL closes inactive connections after 8 hours (default wait_timeout). I assume the above problem is caused because ZoneMinder does not keep its MySQL connection alive, but expects it to still be there when a new event occurs, possibly days since the last event.
Is there a database keepalive mechanism, or has this been added in a more recent version? If not, is anyone using a workaround?
I could restart the service if there hasn't been an alarm for 8 hours, but this seems a little heavy handed when a database ping is all that's required.