Memory allocation problems. Camera goes to black.

Forum for questions and support relating to the 1.24.x releases only.
Locked
ptosiani
Posts: 10
Joined: Wed Aug 12, 2009 10:22 pm

Memory allocation problems. Camera goes to black.

Post by ptosiani »

Hello, i just reinstalled the system, it's Debian Lenny:
root@zmserver:~# uname -a
Linux zmserver 2.6.26-2-686 #1 SMP Sun Jul 26 21:25:33 UTC 2009 i686 GNU/Linux
I installed Zoneminder from repositories, then followed this guide:

http://www.zoneminder.com/forums/viewt ... 006cca1fb

I changed the value of /etc/sysctl.conf:
kernel.shmall = 268435456
kernel.shmmax = 268435456
and this is my ipcs -m output:
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x7a6d0002 229377 www-data 700 10138792 1
0x7a6d0003 65538 www-data 700 9217192 1
I have 3 Cameras (2 DCS-6620) And they go to black randomly, this is the output from tail -f /var/log/ syslog | grep ERR
Aug 13 17:42:12 zmserver zmwatch[3093]: ERR [Can't get shared memory id '7a6d0001', 1: No such file or directory]
Aug 13 17:42:22 zmserver zmwatch[3093]: ERR [Can't get shared memory id '7a6d0001', 1: No such file or directory]
Aug 13 17:42:32 zmserver zmwatch[3093]: ERR [Can't get shared memory id '7a6d0001', 1: No such file or directory]
Aug 13 17:44:31 zmserver zmc_m1[3421]: ERR [Invalid JPEG file structure: two SOI markers]
Aug 13 17:44:31 zmserver zmc_m1[3421]: ERR [Unable to decode jpeg]
Aug 13 17:44:31 zmserver zmc_m1[3421]: ERR [Failed to capture image from monitor 1 (0/1)]
Aug 13 17:44:31 zmserver zmdc[3051]: ERR ['zmc -m 1' exited abnormally, exit status 255]
Aug 13 17:44:32 zmserver zmwatch[3093]: ERR [Can't get shared memory id '7a6d0001', 1: No such file or directory]
Aug 13 17:44:41 zmserver zmc_m2[3336]: ERR [Invalid JPEG file structure: two SOI markers]
Aug 13 17:44:41 zmserver zmc_m2[3336]: ERR [Unable to decode jpeg]
Aug 13 17:44:41 zmserver zmc_m2[3336]: ERR [Failed to capture image from monitor 2 (0/1)]
Aug 13 17:44:41 zmserver zmdc[3051]: ERR ['zmc -m 2' exited abnormally, exit status 255]

Thanks for your help!
trendkill
Posts: 35
Joined: Sat Mar 10, 2007 1:48 pm

Post by trendkill »

I have the same pronlem. Ubuntu Karmic, ZM 1.24.2
There are 4 IP cams (grand ip cam pro), and 4 analog cams, 2 gigs of ram. All cams working in 640x480.
One of my IP cam is blank, but yestreday was okey, I didn't change anything.

kernel.shmall = 536870912
kernel.shmmax = 536870912
(I tried with 268435456, but the same)

zm.log:

Nov 7 17:42:42 dxn-dvr zmdc[1385]: INF [Starting pending process, zmc -m 4]
Nov 7 17:42:42 dxn-dvr zmdc[1664]: INF ['zmc -m 4' started at 09/11/07 17:42:42]
Nov 7 17:42:42 dxn-dvr zmdc[1385]: INF ['zmc -m 4' starting at 09/11/07 17:42:42, pid = 1664]
Nov 7 17:42:42 dxn-dvr zmc_m4[1664]: INF [Debug Level = 0, Debug Log = <none>]
Nov 7 17:42:42 dxn-dvr zmc_m4[1664]: INF [Starting Capture]
Nov 7 17:42:42 dxn-dvr zms[1656]: WAR [Unable to store frame as timestamp invalid]
Nov 7 17:42:45 dxn-dvr zmc_m4[1664]: ERR [Bogus Huffman table definition]
Nov 7 17:42:45 dxn-dvr zmc_m4[1664]: ERR [Unable to decode jpeg]
Nov 7 17:42:45 dxn-dvr zmc_m4[1664]: ERR [Failed to capture image from monitor 4 (0/1)]
Nov 7 17:42:45 dxn-dvr zmdc[1385]: ERR ['zmc -m 4' exited abnormally, exit status 255]
Nov 7 17:42:46 dxn-dvr zms[1656]: ERR [Frame send time 2337 msec too slow, throttling maxfps to 1.98]
Nov 7 17:42:46 dxn-dvr zms[1656]: WAR [Unable to store frame as shared memory invalid]
Nov 7 17:42:47 dxn-dvr zms[1656]: WAR [Unable to store frame as shared memory invalid]
Nov 7 17:42:55 dxn-dvr zmdc[1385]: INF [Starting pending process, zmc -m 4]
Nov 7 17:42:55 dxn-dvr zmdc[1666]: INF ['zmc -m 4' started at 09/11/07 17:42:55]
...
Nov 7 17:47:47 dxn-dvr zms[1728]: INF [Debug Level = 0, Debug Log = <none>]
Nov 7 17:47:47 dxn-dvr zms[1728]: INF [Authenticated user 'admin']
Nov 7 17:47:47 dxn-dvr zms[1728]: WAR [Shared data not initialised by capture daemon, some query functions may not be available or produce invalid results]
Nov 7 17:47:47 dxn-dvr zms[1728]: WAR [Unable to store frame as shared memory invalid]
...
Nov 7 18:01:48 dxn-dvr zms[1900]: WAR [Unable to store frame as shared memory invalid]
Nov 7 18:01:58 dxn-dvr zms[1900]: ERR [Terminating, last frame sent time 10.026311 secs more than maximum of 10.000000]
Nov 7 18:02:17 dxn-dvr zmu[1903]: WAR [Shared data not initialised by capture daemon, some query functions may not be available or produce invalid results]


whats happend?
KeithB
Posts: 77
Joined: Thu Jun 07, 2007 4:23 pm
Location: uk

Post by KeithB »

kernel.shmall should be something less than the total RAM on your server divided by 4096 say 1000000 ( 1 million) on a 4GB system.
kernel.shmax set at 180000000 ( 180 million) should be enough unless you are doing something unusual.
trendkill
Posts: 35
Joined: Sat Mar 10, 2007 1:48 pm

Post by trendkill »

Isn't shmall (500000) too low? As I read in the wiki, they recommed minimum 134217728 for both, if you use 640x480.
The camera sometimes working, sometimes not. But only this one.
When it's working the image is very bad. Sample: http://montenegrofly.hu/Event-23234-r1-s1.avi
Isn't the camera bad?

KeithB wrote:kernel.shmall should be something less than the total RAM on your server divided by 4096 say 1000000 ( 1 million) on a 4GB system.
kernel.shmax set at 180000000 ( 180 million) should be enough unless you are doing something unusual.
TechGuy
Posts: 47
Joined: Sun Oct 18, 2009 8:16 pm

Post by TechGuy »

Also check your buffer counts. An excessive number of frame buffers can result in running out of memory. FWIW, i have my shmmax set to 4 GB.
whatboy
Posts: 304
Joined: Mon Aug 31, 2009 10:31 pm

Post by whatboy »

The wiki explains it quite simple...

((Resolution)H*W*(color)24*(frame ring)80*(numberofcameras)3+10%)/8(bytes, not bits)


http://www.zoneminder.com/wiki/index.ph ... esolutions.

by the way mine is...
kernel.shmall = 512000
kernel.shmmax = 535265280

6 cameras @ 740*480
Locked