Page 1 of 2

ZM 1.22.3 using all memory and swap

Posted: Mon Feb 26, 2007 7:53 pm
by Hack
I used a livecd (xubuntu) to setup a Zm system with a bt878 4 port card. The box has a p4 3.0 800fsb and 2gb ram and 1gb swap. When I leave two cameras running in a browser window for a couple days some process then kicks in and simply overwhelms the box. It uses all 3 gb's of ram and swap and the box come to a crawl. I don't record or motion check the output for recording, I just want it to view what the cameras are outputing. I searched the forums under memory and swap and there are tons of them, but most are for machines that are not as hefty as this one is. is there something I need to turn off? I would think that I should be able to view at 40fps as long as I'm not recording. Please any ideas are most welcomed.


Posted: Mon Feb 26, 2007 9:09 pm
by mrd
You need to change the option to stop using nph-zms in options.

Change nph-zms to zms in options/paths:

ZM_PATH_ZMS = /cgi-bin/zms

As far as I know, this is a problem with apache2 and this change works much better for me. I still see some memory leaking, but not nearly as much on my system.

Posted: Tue Feb 27, 2007 9:01 am
by cordel
Check to see what process is consuming the resources, I be will ing to bet it the browser. You will have to configure the bowser so that it don't cache.

Posted: Tue Feb 27, 2007 2:50 pm
by mrd
On my Xubuntu system nph-zms was consuming the most and after making the change I described, it seems to be a huge improvement. Prior to the change I would run the system for about 24 hours and then it would slow to a crawl until I rebooted.

I've read that there is a bug in Apache2 that causes the memory leak. Is this no longer the case?

Posted: Wed Feb 28, 2007 6:48 am
by cordel
The bug with apache is a few years old and was resolved by the apache team.

Posted: Wed Feb 28, 2007 2:12 pm
by mrd

With ZM_PATH_ZMS = /cgi-bin/nph-zms my Xubuntu system will just about die after a few days of running without having a browser open for any length of time. There ends up being several/duplicate nph-zms processes running and I end up rebooting to resolve the memory and process issues. If I set ZM_PATH_ZMS = /cgi-bin/zms then everything works much better and there is far less memory usage.

Any ideas?

Posted: Wed Feb 28, 2007 4:46 pm
by cordel
There is no difference between the to binaries other than the name. Any cgi run by apache that starts with nph (Which stands for "No Parse Headers) forces apache to not parse the headers.

Posted: Wed Feb 28, 2007 5:00 pm
by mrd

So then if there is no difference except for the way apache handles this with it set to use nph and there are significant memory leaks... is this not a problem with apache?

Posted: Thu Mar 01, 2007 2:45 am
by cordel
Since I don't know your system, or how you have it configured, I really couldn't say. I do know out of thousands of users not many report this issue with current versions of apache. I know that I have no issues with either binary. If your having these issues, I might split this thread since we have now runaway with this guys thread which is some what rude.

Update ZM using all memory resources

Posted: Thu Mar 01, 2007 7:19 pm
by Hack
First off, I want to apologize for appearing rude. That was definetly not my intent at all.

I did a test where I let the system idle for two days without the zm browser window open. I checked the memory usage over that time and it is not being used by any other programs. Even the nightly cron jobs don't have any effect on the system of the 2gb of physical ram it used at max 524m. So that leaves it back to the zm processes I think. I will try that path change and report back in a day or two. Thanks for the idea to try.


Posted: Fri Mar 02, 2007 8:44 pm
by cordel
I was not refering to you being rude, but mrd and myself for running away with your thread :lol:

Posted: Thu Mar 08, 2007 4:52 pm
by CoolRide
I can confirm that if you use nph-zms, Apache2 will eat all your memory and Cpu even Cpu's if you have a dual core.

To solve that I have set the ZM_PATH_ZMS = /cgi-bin/zms in the startscript.
since that moment I never saw the problem again.

Posted: Thu Mar 08, 2007 5:00 pm
by cordel
Okay so to help get to the bottom of this:
Apache Version?

Posted: Thu Mar 08, 2007 10:15 pm
by babba

I am a 'bloody' ZonMinder beginner and just had not the guts to report exacly the same problem described above.

Due to very limited Linux experiance I was somehow assuming I am the problem :oops:

Glad to see that others do see the same.

I'll try the hint and set nph-zms to zms in options/paths:

ZM_PATH_ZMS = /cgi-bin/zms

Thanks for this great piece of SW and Thanks for all the good support.

Greetings Dieter

Posted: Fri Mar 09, 2007 12:13 am
by cordel
Great, four reports
cordel wrote:Okay so to help get to the bottom of this:
Apache Version?
PHP version should be on that list as well.
Whether you used a package or built from source would be good to know as well.

But without knowing your setup, it's some what hard for us to replicate and work to find a fix.

Help Us to be able to help you Please, otherwise are hands are tied and no one will bother looking for it and I might as well just round file this post.