Question about /dev/shm size

Discussions related to the 1.36.x series of ZoneMinder
Post Reply
lonelyadmin
Posts: 2
Joined: Fri Jun 20, 2025 3:45 pm

Question about /dev/shm size

Post by lonelyadmin »

I'm running 1.37.66 from the Debian 12 repo. My box has been pretty stable until I recently added more cameras to it. I'm thinking the problem is related to /dev/shm, but I'm not sure.

The system has 32G of RAM and usually has half of that unused. /dev/shm is set to 8G and usage caps out exactly at 2G used, never more. I'm getting OOM messages and errors about not being able to access /dev/shm/zm.mmap.* files, though those files are often in there and are either 48M or 91M. (is the digit at the end of /dev/sh/zm.mmap the camera ID? Just curious).

Am I right to be looking at shm as the source of my errors?

I'm familiar with linux, just not Debian 12 specifically. Not sure if they do something different as far as limitations on /dev/shm usage.

Please help!
User avatar
iconnor
Posts: 3391
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Question about /dev/shm size

Post by iconnor »

No /dev/shm isn't the issue, yes the number is the monitor id.

Your zmc processes are consuming too much ram. Either because something is slow (disk,db, both) or you are trying to capture an 8k cam or something. Point is it is trying to use too much ram.

You will have to dig into logs to figure out why.

Do you have a MaxImageBUffer set?
lonelyadmin
Posts: 2
Joined: Fri Jun 20, 2025 3:45 pm

Re: Question about /dev/shm size

Post by lonelyadmin »

I've got low res monitoring and linked high res motion capture setup.
The capture resolution is either 352x240 -> 2592x1520 or 640x360 -> 1920x1080, depending on the camera.

Camera count:
17x 640x360 -> 1920x1080
14x 352x240 -> 2592x1520

Buffers for each monitor are default:
Image Buffer Size (frames): 3
Maximum Image Buffer Size (frames): 121
Warmup Frames: 0
Pre Event Image Count: 5
Post Event Image Count: 5
Stream Replay Image Buffer: 0
Alarm Frame Count: 1
The estimated usage changes per camera.

I've just tweaked mysqld. I had some things enabled from setup that weren't helping like query logging. I ran one of those tuner scripts.

This is the largest zm server I've ever worked with, so I'm learning here!

Actual RAM doesn't seem to be filling up, but swap is..turns out I only had a 1G swap partition. I'm working on expanding that now.
User avatar
iconnor
Posts: 3391
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Question about /dev/shm size

Post by iconnor »

I like to use zram for swap.

That's a lot of cameras... of a high enough res...
aarons6
Posts: 49
Joined: Mon Feb 08, 2016 12:13 pm

Re: Question about /dev/shm size

Post by aarons6 »

lonelyadmin wrote: Fri Jun 20, 2025 3:53 pm I'm running 1.37.66 from the Debian 12 repo. My box has been pretty stable until I recently added more cameras to it. I'm thinking the problem is related to /dev/shm, but I'm not sure.

The system has 32G of RAM and usually has half of that unused. /dev/shm is set to 8G and usage caps out exactly at 2G used, never more. I'm getting OOM messages and errors about not being able to access /dev/shm/zm.mmap.* files, though those files are often in there and are either 48M or 91M. (is the digit at the end of /dev/sh/zm.mmap the camera ID? Just curious).

Am I right to be looking at shm as the source of my errors?

I'm familiar with linux, just not Debian 12 specifically. Not sure if they do something different as far as limitations on /dev/shm usage.

Please help!
what are you using for buffer size? because i have 10 cameras and my system has 80 gb of ram.. it runs out if i dont cap the buffers to like 100/150.
when it does, the zmc crashes and the camera is offline until it restarts.. they constantly crash and restart all day long.
also even tho /dev/shm seems like its not being used.. if you lower it, zoneminder crashes.

i also experience the swap file filling up and crashing the whole system. my swap file is 8gb..
i had to run a cron to restart zoneminder every few hours to keep it from doing that.
User avatar
burger
Posts: 476
Joined: Mon May 11, 2020 4:32 pm

Re: Question about /dev/shm size

Post by burger »

lonelyadmin wrote: Fri Jun 20, 2025 8:17 pm I've got low res monitoring and linked high res motion capture setup.
The capture resolution is either 352x240 -> 2592x1520 or 640x360 -> 1920x1080, depending on the camera.

Camera count:
17x 640x360 -> 1920x1080
14x 352x240 -> 2592x1520

Buffers for each monitor are default:
Image Buffer Size (frames): 3
Maximum Image Buffer Size (frames): 121
I have 30-40 cameras. I don't run Linked monitors. I use the other technique commonly talked about of the low res, but using passthrough. See: https://wiki.zoneminder.com/Dummies_Gui ... Zoneminder

I have my Maximum Image Buffer Size set to 0. I used to have memory errors, and it would give me events of a very short duration, but setting it to zero resolved that. The web console tells me that 1% of /dev/shm is used up.

The only error I get is some database corruption when trying to shutdown via cron, or when there is a power loss. But that is a different issue, which I'm somewhat lazily working through. Otherwise the system is stable. Motherboard is a Dell 00NH4P (though I don't recommend it, since it can't run in JBOD mode). 12 core Xeon. See the following htop sorted by the highest RAM usage of zmc.
zm_performance.png
zm_performance.png (272.02 KiB) Viewed 440 times
fastest way to test streams:
ffmpeg -i rtsp://<user>:<pass>@<ipaddress>:554/path ./output.mp4 (if terminal only)
ffplay rtsp://<user>:<pass>@<ipaddress>:554/path (gui)
find paths on ispydb or in zm hcl

If you are new to security software, read:
https://wiki.zoneminder.com/Dummies_Guide
Post Reply