Memory leaks

Support and queries relating to all previous versions of ZoneMinder
Locked
igord
Posts: 5
Joined: Tue Jul 22, 2003 11:38 am

Memory leaks

Post by igord »

So far max uptime less that 24 hours.
The system : Cel 700/192 Mb RAM/192 Mb SWAP, one card, one camera.
RHL9 fresh install, no updates.
No other services (except sshd).
After 21 hours of uptime the SWAP was filled and the system stopped responding.
Saw it in the README but maybe the issue was solved ?

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

Re: Memory leaks

Post by zoneminder »

Hi Igor,

As far as I know the issue isn't fixed yet but I'm not really sure whether it's a g++ thing or one of the system libraries. I don't think it's a ZM problem.

Can you tell me what the processes look like once the leaks start, perhaps capture the output from 'top'.

I have a RH9 being set up to test with, unfortunately I wiped it and so have had to reload it and try to remember how I got it working with the LML board in there. It should be up soon though and I can do some more probing.

Phil,
igord
Posts: 5
Joined: Tue Jul 22, 2003 11:38 am

Re: Memory leaks

Post by igord »

15:07:54 up 16:27, 1 user, load average: 2.47, 2.19, 1.88
59 processes: 54 sleeping, 5 running, 0 zombie, 0 stopped
CPU states: 35.5% user 2.9% system 0.0% nice 0.0% iowait 61.4% idle
Mem: 190632k av, 187608k used, 3024k free, 0k shrd, 1328k buff
103384k actv, 2644k in_d, 3124k in_c
Swap: 192772k av, 192772k used, 0k free 13340k cached

PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CPU COMMAND
1727 apache 15 0 198M 39M 148 S 0.1 21.3 6:59 0 httpd
1726 apache 15 0 29004 24M 148 S 0.9 13.3 0:40 0 httpd
23986 apache 18 0 12696 12M 2160 R 0.0 6.6 0:02 0 zmfilter.pl
1897 apache 15 0 4496 4276 3348 S 4.7 2.2 73:16 0 zma
21174 apache 16 0 3748 3740 3144 R 15.7 1.9 20:44 0 zms
3116 apache 16 0 3968 3616 3052 R 16.3 1.8 158:26 0 zms
1859 apache 15 0 70128 3296 3116 S 0.0 1.7 2:00 0 zmc
1840 apache 15 0 3740 2204 528 S 0.0 1.1 0:37 0 zmdc.pl
1656 mysql 15 0 2856 2156 900 S 0.0 1.1 1:04 0 mysqld
3121 apache 15 0 3408 1476 172 S 0.0 0.7 0:00 0 httpd
1719 apache 16 0 3412 1472 192 S 0.0 0.7 0:00 0 httpd
1720 apache 17 0 3392 1432 176 S 0.0 0.7 0:00 0 httpd
1725 apache 15 0 3376 1420 172 S 0.0 0.7 0:00 0 httpd
3123 apache 15 0 3352 1408 164 S 0.0 0.7 0:00 0 httpd
1724 apache 15 0 6568 1404 180 S 0.0 0.7 0:01 0 httpd
1718 apache 15 0 9160 1400 172 S 0.0 0.7 0:02 0 httpd
1721 apache 15 0 9188 1396 184 S 0.0 0.7 0:02 0 httpd
3122 apache 15 0 6488 1388 104 S 0.0 0.7 0:01 0 httpd
1882 apache 15 0 3192 1076 468 S 0.0 0.5 0:03 0 zmwatch.pl
22468 root 15 0 636 636 352 R 0.1 0.3 0:14 0 top
1901 apache 15 0 756 436 248 S 0.0 0.2 0:55 0 zmf

Now it has eaten all the memory even faster.
Maybe it would be better to install an older RH release or to compile Apache from source ?

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

Re: Memory leaks

Post by zoneminder »

Thanks Igor, it obviously appears to be apache that is leaking memory.

Can you tell me what version of apache you have? There is a known leak in versions 2.0 to 2.0.44 which may have something to do with it. Can you tell me if you are accessing ZM with IE or some other browser. If it is IE I would be interested to know if you still get the leak with Netscape or Mozilla or another browser that handles streams natively.

The reason I ask is because the Apache leak is to with linefeeds sent in requests and as far as I know none are sent specifically by ZM but it's possible Cambozola terminates it's requests with linefeeds and that is what is causing the leak. It might not be that in which case I'll keep looking but it would be useful to know.

Phil,
igord
Posts: 5
Joined: Tue Jul 22, 2003 11:38 am

Re: Memory leaks

Post by igord »

[root@monitor root]# rpm -qa | grep httpd
httpd-2.0.40-21
httpd-manual-2.0.40-21

As I said above, the default install with no updates.
I use NS7, IE6 on WinXP and IE5 on Win2K. IE only for still images. Cambozola doesn't work, neither 0.22 nor the latest. Both leak memory and hang the system.
The above mentioned state was reached when noone was watching the feeds (in the night). So it's not the browser.
Tomorrow I'll reinstall the system onto a better machine and compile the latest stable Apache. And let you and the rest know.

Cheers
eservaas
Posts: 3
Joined: Wed Jul 23, 2003 9:47 am

Re: Memory leaks

Post by eservaas »

Hi,
I am using apache 2.047, now problems with this one.
do'n use 2.0 /2.044 these are known to have linefeed memory leaks.
Any attacker will be able to hang your server with a simple command.
User avatar
tech_fixer
Posts: 132
Joined: Tue Jul 29, 2003 3:07 pm

Re: Memory leaks

Post by tech_fixer »

MEMORY LEAK ON RH9 PROBLEM SOLVED

Upgrade RH9 httpd package to version 2.0.45.
RPMs and SRPMs available at rpmfind.net.

If building from SRPM, you will have to recompile some apache modules before installing. In my case it was:
mod_auth_mysql
mod_auth_pgsql
PHP
mod_python
mod_perl
mod_ssl

Now, mod_ssl comes with apache, so when installing do:
rpm -Uvh http*rpm mod_ssl*rpm --nodeps

Then proceed to rebuild the other modules, available from your RH9 CD or RH website.
For mod_perl use version 1.99_09-6.src.rpm from rpmfind.net. The mod_perl in RH9 CD doesn't play nice with Apache 2.0.45.

Any questrions? Feel free to ask... thats what we're here for.

ZoneMinder rocks!

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

Re: Memory leaks

Post by zoneminder »

Excellent, thanks for this Jose.

This will be the first entry in the new FAQ section going up later today!

Cheers,

Phil,
loop
Posts: 69
Joined: Thu Nov 06, 2003 3:10 pm

Re: Memory leaks

Post by loop »

Hi,
could someone describe how to update httpd on RH9 to 2.0.45.
I couldn't find any RPMs for that on rpmfind, I've removed all mods, php etc. RPM-s from my original RH9 installation in order to be able to rpm -e httpd. Now I need to know how to get the things back with 2.0.45.

Why 2.0.45? Why now the recent 2.0.48 ?

Rehards,
Darko
pchan
Posts: 50
Joined: Thu Jan 15, 2004 9:38 pm

Re: Memory leaks

Post by pchan »

Does anyone know if the latest RH9 httpd patch version
httpd-2.0.40-21.9

is supposedly fixed or does it still contain this memory leak? I'm really dreading recompiling httpd and I can't find any later version RPM's for RH9.
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Re: Memory leaks

Post by zoneminder »

The rpm I used (which is referred to in the other threads) is <a href="http://people.redhat.com/jorton/Shrike- ... m">here</a> but I don't know if it has been superseded by an official one yet.

Phil,
pchan
Posts: 50
Joined: Thu Jan 15, 2004 9:38 pm

Re: Memory leaks

Post by pchan »

Here's a link to some new updates I found (probably what Jose was referring to above):

HTTPD packages: http://www.btree.org/linux/packages/red ... -2.0.45-2/
Addt'l Apache modules: http://www.btree.org/linux/packages/red ... pd-2.0.45/

It will also be necessary to grab the Apache Runtime Library at:
http://download.fedora.redhat.com/pub/f ... 2.i386.rpm
http://download.fedora.redhat.com/pub/f ... 2.i386.rpm

I'm currently using this updated Apache 2.0.45 with Redhat 9 + Kernel 2.6.1 and ZM 1.17.2.
Locked