Multiple zma processes on Record - ARM platform

Forum for questions and support relating to the 1.32.x releases only.
Post Reply
User avatar
snake
Posts: 142
Joined: Sat May 21, 2016 2:20 am

Multiple zma processes on Record - ARM platform

Post by snake » Fri Dec 28, 2018 7:00 am

I did some benchmarking of ZM and found that Modect performed better than Record. It looks like Record spawns a number of zma daemons that load the CPU. This was using ZM 1.32.2 on the RPI 3. To install, I used Raspbian Stretch Lite, and added the sid and experimental repos, per the guide here: https://wiki.zoneminder.com/Debian

This is after a reboot, and there are no other visible errors. I tried enabling logs, but zma_m1 only mentions that the shared memory is not initialized by the daemon (when in record). I did not check zma_m1 when in modect.

I wonder if anyone else is seeing this? Based on my older setup, I understand there is typically 1 zma process per camera.

Here are two screenshots that illustrate the behaviour I am seeing:
record_highcpuuse_multiplezma.jpg
record_highcpuuse_multiplezma.jpg (244.89 KiB) Viewed 378 times
modect_lowcpuuse.jpg
modect_lowcpuuse.jpg (236.84 KiB) Viewed 378 times

User avatar
knight-of-ni
Posts: 2209
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Multiple zma processes on Record - ARM platform

Post by knight-of-ni » Fri Dec 28, 2018 1:32 pm

You have an abnormal condition. You should have precisely one zma running, but it looks like you have 10 in that first screenshot!
See how the Log button is red? That means you have errors. What do those errors say?

Try stopping zoneminder, verify there are no zm* processes, then start zoneminder back up while watching your logs. What I expect to see is zma failing, then zmwatch tries to spawn a new zma, but the old zma does not die.

What is the resolution and frame rate of the camera in question?
What are you writing events to?
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/

User avatar
snake
Posts: 142
Joined: Sat May 21, 2016 2:20 am

Re: Multiple zma processes on Record - ARM platform

Post by snake » Mon Dec 31, 2018 11:22 pm

record_multiplezmas_weblog2.jpg
record_multiplezmas_weblog2.jpg (322.85 KiB) Viewed 342 times
The errors don't seem to indicate anything regarding ZMA. I tried changing Analysis Frames, as well as increasing Buffer frames, but there is no difference.

Resolution is 800x600. FPS is limited at 20, and ZMC records around 11FPS. I tried limiting FPS at the camera to 3, restarting ZM, but the issue remains. I am writing the the default /var/cache/zoneminder/events which is an SD card.

I did some more testing, and Mocord has the same issue. Monitor, Nodect, and Modect do not have issues with ZMA (Nodect and Monitor don't run ZMA).

I will attach the logs in the next post...
Attachments
record_multiplezmas_weblog.jpg
record_multiplezmas_weblog.jpg (406.39 KiB) Viewed 342 times
modect_weblog.jpg
modect_weblog.jpg (196.71 KiB) Viewed 342 times
Last edited by snake on Mon Dec 31, 2018 11:25 pm, edited 1 time in total.

User avatar
snake
Posts: 142
Joined: Sat May 21, 2016 2:20 am

Re: Multiple zma processes on Record - ARM platform

Post by snake » Mon Dec 31, 2018 11:23 pm

Debug and Info logs attached.
Attachments
zm_syslog_startup_debuglevel.txt
(456.22 KiB) Downloaded 13 times
zm_syslog_startup_infolevel.txt
(9.5 KiB) Downloaded 14 times

User avatar
knight-of-ni
Posts: 2209
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Multiple zma processes on Record - ARM platform

Post by knight-of-ni » Tue Jan 01, 2019 2:03 pm

The first thing you need to do, before anything else is fix those buffer overruns. That is the biggest source of your troubles.
You are hitting a resource bottleneck on your hardware, and as long as you see those errors in your logs, ZoneMinder will not be stable (i.e. zma, zmaudit, zmfilter, any zm process will be subject to failure).

You need to slow down your capture (just like the warning says) so lower the frame rates in your camera to something more reasonable, like 5 fps. Even that may not be enough. SD cards are the slowest thing you can buy these days in terms of read/write speeds. You need to write to something else. An SSD attached to USB is about the best you can do with the rpi. That's how I did it:
https://zoneminder.blogspot.com/p/raspberry-pi-3.html

You could also use a NAS if you have one.

Maybe I am misreading you logs, but it looks like you are attempting to use x264 encode. That mode is not currently compatible on Arm architecture, and I'm not sure how you even enabled it since we disabled it from the gui. It will appear to work, but the recorded video will not be playable. Passthrough should work though.

Turn off zmaudit.
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/

User avatar
snake
Posts: 142
Joined: Sat May 21, 2016 2:20 am

Re: Multiple zma processes on Record - ARM platform

Post by snake » Mon Jan 07, 2019 3:19 am

knight-of-ni wrote:
Tue Jan 01, 2019 2:03 pm
Maybe I am misreading you logs, but it looks like you are attempting to use x264 encode. That mode is not currently compatible on Arm architecture, and I'm not sure how you even enabled it since we disabled it from the gui. It will appear to work, but the recorded video will not be playable. Passthrough should work though.
This turned out to be the bug. This was a fresh install - I had not set anything in the Storage tab, so what you saw was correct. It was attempting to use x264 encode, and somewhere the error was of the multiple ZMA entries. Once I disabled x264 encode (and I also set it to save JPEG frames (as encode is disabled, and this is MJPEG, not an H264 stream - so passthrough doesn't make sense)), then the multiple ZMAs disappeared. I'm not sure what the best solution is, but my initial thought is to not default to x264 encode in ARM. Maybe it should never default to H264 encode... Not sure.

Note that once I set "Video Writer" to disabled, then it was not possible to choose x264 encode, as you mentioned. But on a default ZM 1.32.2 install Video Writer is set to x264 encode, even if it's not functional on ARM, and must be deselected.

Otherwise, working good. I have an RPI3 w/ 800x600 MJPEG 10FPS Load of about 1.
Now I can return to benchmarking this.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests