Shared Memory problem - zmc dies

Support and queries relating to all previous versions of ZoneMinder
Locked
fcrossen
Posts: 16
Joined: Thu Jun 09, 2005 10:22 am
Location: Dublin, Ireland.

Shared Memory problem - zmc dies

Post by fcrossen »

Here goes:

(I've looked at the FAQ but perhaps I'm missing something.)

I was doing great until I added an extra Axis 206W to my network.

When I added the extra camera I started to get problems with the two Axis Cameras. The image in the camera monitor kept flicking back and forth between the two camera images (shared memory problem?).

Image buffer is 60.

I started tweaking and tried the following:

Code: Select all

kernel.shmmax = 157286400
kernel.shmall = 157286400
net.core.wmem_max=131072
I've two 640 x 480 and one 320 x 240 camera at full color. The problems started when the second camera was added.

Shared memory use:

Code: Select all

------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status
0x7a6d2005 1245184    apache    700        9216548    2
0x7a6d2009 1277953    apache    700        55296628   2
0x7a6d200b 1310723    apache    700        55296628   1
In zmdc.log I get the following:

Code: Select all

zmc: zm_image.h:185: void Image::CopyBuffer(const Image&): Assertion `width == i
mage.width && height == image.height && colours == image.colours' failed.
'zmc -m 11' died at 05/07/07 16:19:52, signal 6
Starting pending process, zmc -m 11
'zmc -m 11' started at 05/07/07 16:29:52
'zmc -m 11' starting at 05/07/07 16:29:52, pid = 29518
zmc: zm_image.h:185: void Image::CopyBuffer(const Image&): Assertion `width == i
mage.width && height == image.height && colours == image.colours' failed.
'zmc -m 11' died at 05/07/07 16:29:52, signal 6
Do you think this is a memory issue? Frankly I'm stumped - SHMMAX and SHMALL are both 150MB, and it looks like this is fine. However I not expert enough figure this one out.

Any ideas?
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

Have you tried restarting so that the memroy can be realocated?
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

The assertion messages invariably means that the image you are getting back from the camera is not the same size, or colour depth, as that which you have configured your monitor for.

That's the first thing to check anyway. As cordel says though, it's always worth restarting ZM whenever you make any changes that might affect shared memory.

Phil
fcrossen
Posts: 16
Joined: Thu Jun 09, 2005 10:22 am
Location: Dublin, Ireland.

Post by fcrossen »

I've already restarted ZM after every change.

When I changed the shared memory I used

Code: Select all

echo 157286400 >/proc/sys/kernel/shmall
echo 157286400 >/proc/sys/kernel/shmmax
as well as making the change in sysctl.conf (following the advice in http://www.zoneminder.com/index.php?id= ... faq_faq=10)

I've also double checked the camera settings and they are identical (2 x Axis 206W).

Now a funny thing happened:

While writing this I tried to 'swap' the cameras by simply changing the IP address in the main ZM monitor screen. This worked for me - monitor 8 always showed an image and monitor 11 didn't. It didn't matter which IP address the monitor was grabbing it's image from - monitor 8 gives a picture and monitor 11 doesn't.

However, while playing around and verifying settings for each monitor I disabled the image rotation feature on monitor 11 (the camera is on it's side). This gives me a picture!

If I set the image to be 'rotated left' I loose the picture - leave it as 'normal' and it's fine. I tried swapping the image height and width attributes to see if this was causing the problem but to no avail.

At the moment I'm recording fine (sideways but fine)!!!

The errors are gone from the logs.

Might this be a bug or have I lost the plot completely?!
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

have you set the resolution correctly after rotating it. As far as i understand part of zm rotates it before capture so the res setting needs to take into account the rotate
ie 640 x 480 becomes 480 x 640 (i think)

James
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

Sounds like there could be a bug. Have you tried the other rotation options yet? Which ones work and which ones don't.
Regards,
Cordel
fcrossen
Posts: 16
Joined: Thu Jun 09, 2005 10:22 am
Location: Dublin, Ireland.

Post by fcrossen »

Both 'flip' options are fine as are 'inverted'.

Rotate throws a wobbly:

If I rotate and do not change the image resolution, I get a broken image and the following errors in zmdc.log:

Code: Select all

Starting pending process, zmc -m 11
'zmc -m 11' started at 05/07/08 14:53:16
'zmc -m 11' starting at 05/07/08 14:53:16, pid = 3007
zmc: zm_image.h:185: void Image::CopyBuffer(const Image&): Assertion `width == i
mage.width && height == image.height && colours == image.colours' failed.
'zmc -m 11' died at 05/07/08 14:53:18, signal 6
If I rotate and DO change the resolution to 480 x 640 instead of 640 x 480 I get a corrupted image.
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

I suspect this may be a bug with rotated netcam images. I'll check and if it's a simple fix put a patch up asap.

Phil
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Yes, I was right. A bug had slipped in and broken the rotate functionality.

Anyway, I'vew done a patch is at http://www.zoneminder.com/downloads/zmi ... .2-p01.txt.

You will need to apply this to your src directory, and then rebuild and reinstall etc.

Phil
fcrossen
Posts: 16
Joined: Thu Jun 09, 2005 10:22 am
Location: Dublin, Ireland.

Post by fcrossen »

Small thing to anyone confused by patching:

Apply the patch to:

[ZM-source-dir]

and not to

[ZM-source-dir]/src

(Nice work Phil! One of the best supported pieces of software I've ever come across.)
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

FYI This is fixed in the RPM I have in my test directory of my FTP and web site.
Regards,
Cordel
Image
Image
3939663646337

It's better to keep your mouth shut and appear stupid than open it and remove all doubt.
-Mark Twain
Locked