Re: [PHP4BETA] mem leak?
| From: | Andi Gutmans | Date: | Mon, 13 Mar 2000 17:58:35 +0000 |
| Subject: | Re: [PHP4BETA] mem leak? | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-16755@lists.php.net to get a copy of this message | ||
I'm not sure how to tackle this problem. (BTW, please Cc: php-dev when you
send me mail because there might be people who have bumped into such
behavior).
Do you have a test server where youcan disable libzmod, mod_rewrite, and
mod_expires just to cut it down to Apache core vs. PHP?
Andi
On Mon, 13 Mar 2000, Gaylord Aulke wrote:
> in my opinion the only "strange" thing about the server configuration is
> a module called "ZMOD" that's used to enable the apache to write
> IVW-certified log files (http://www.ivw.de). this module is installed
> on germany's biggest websites an so should be widely tested.
>
> i think the speed of memory-dropping is relative to the number of
> accesses.
>
> i attached PHP and APACHE config.information to this mail.
> you can also call http://knowone.de/test.php to get all
> information
> that's provided by phpinfo().
>
> gaylord
>
> apache-config:
> ./configure \
> "--with-layout=Apache" \
> "--prefix=/usr/local/apache" \
> "--activate-module=src/modules/zmod/libzmod.a" \
> "--activate-module=src/modules/php4/libphp4.a" \
> "--enable-module=rewrite" \
> "--enable-module=expires" \
> "$@"
>
> php-config:
> Configure command: './configure' '--enable-track-vars'
> '--disable-debug' '--with-mysql'
> '--with-adabas=/opt/adabas' '--with-apache=/usr/local/src/apache_1.3.11'
> php.ini path: /usr/local/lib
> ZEND_DEBUG=0
> SAPI=Apache
> ZTS is undefined
>
>
>
> Andi Gutmans wrote:
>
> > I'm cc'ing this to the php-dev list.
> > What is your ./configure line for PHP?
> > What about Apache? Do you use any modules such as mod_auth_mysql with your
> > Apache server? It sounds too strange for it to be PHP but it might be.
> > We have had no such leaks on our web server.
> >
> > Andi
> >
> > On Mon, 13 Mar 2000, Gaylord Aulke wrote:
> >
> > > i changed the settings you described and compiled php:
> > > (
> > > php:make clean
> > > php:make
> > > php:make install
> > > apache:make
> > > apache:make install
> > > )
> > > and restarted apache. unfortunately the behaviour did not change.
> > > i included the top-output after 25 minutes at the end of this mail.
> > >
> > > (when starting apache, httpd had 0.3% of the machine's memory)
> > > (the SIZE entry shows that each newly started httpd process allocates
> > > more memory).
> > >
> > > regards,
> > > gaylord aulke
> > >
> > >
> > > 4:25pm up 8 days, 12:00, 6 users, load average: 1.15, 1.12, 1.01
> > > 205 processes: 203 sleeping, 2 running, 0 zombie, 0 stopped
> > > CPU states: 88.3% user, 11.6% system, 0.0% nice, 0.0% idle
> > > Mem: 776892K av, 718084K used, 58808K free, 599264K shrd, 209908K buff
> > > Swap: 1028120K av, 12076K used, 1016044K free 110800K cached
> > >
> > > PID USER PRI NI DSIZE SIZE RSS SHARE STAT LIB %CPU %MEM TIME COMMAND
> > > 23549 adabas 17 -3 4082M 106M 102M 48088 R < 0 55.0 13.4 779:16
> > > db:knowone
> > > 23538 root 0 0 4020M 52968 51M 52872 S 0 0.0 6.8 0:00 db:knowone
> > > 23545 adabas -3 -3 4023M 47040 45M 43900 S < 0 0.0 6.0 1:31
> > > db:knowone
> > > 23558 adabas 0 0 4020M 40404 39M 40304 S 0 0.0 5.1 0:17 db:knowone
> > > 23559 adabas 0 0 4020M 40404 39M 40304 S 0 0.0 5.1 8:47 db:knowone
> > > 23560 adabas 0 0 4020M 40404 39M 40304 S 0 0.0 5.1 0:17 db:knowone
> > > 23561 adabas 0 0 4020M 40404 39M 40304 S 0 0.0 5.1 8:33 db:knowone
> > > 23548 adabas -3 -3 4021M 7400 7344 7044 S < 0 0.0 0.9 0:00
> > > db:knowone
> > > 9776 wwwrun 0 0 3975M 6728 6728 2696 S 0 1.5 0.8 0:05 httpd
> > > 9787 wwwrun 0 0 3975M 6472 6472 2732 S 0 1.1 0.8 0:05 httpd
> > > 9779 wwwrun 0 0 3975M 6432 6432 2724 S 0 0.0 0.8 0:06 httpd
> > > 9747 wwwrun 2 0 3977M 6376 6376 2720 S 0 0.7 0.8 0:05 httpd
> > > 9791 wwwrun 0 0 3975M 6304 6304 2708 S 0 0.5 0.8 0:05 httpd
> > > 9749 wwwrun 0 0 3974M 6224 6224 2656 S 0 0.9 0.8 0:05 httpd
> > > 9806 wwwrun 0 0 3974M 6224 6224 2704 S 0 0.1 0.8 0:05 httpd
> > > 9746 wwwrun 0 0 3974M 6208 6208 2648 S 0 0.0 0.7 0:04 httpd
> > > 9766 wwwrun 0 0 3974M 6176 6176 2724 S 0 0.0 0.7 0:05 httpd
> > > 9751 wwwrun 0 0 3974M 6156 6156 2704 S 0 0.7 0.7 0:04 httpd
> > > 9763 wwwrun 0 0 3974M 6128 6128 2664 S 0 0.0 0.7 0:04 httpd
> > > 9774 wwwrun 0 0 3974M 6120 6120 2704 S 0 0.0 0.7 0:04 httpd
> > > 9764 wwwrun 0 0 3974M 6072 6072 2708 S 0 0.0 0.7 0:05 httpd
> > > 9752 wwwrun 0 0 3974M 6040 6040 2716 S 0 0.3 0.7 0:05 httpd
> > > 9772 wwwrun 0 0 3974M 6036 6036 2668 S 0 0.7 0.7 0:05 httpd
> > > 9793 wwwrun 1 0 3974M 6028 6028 2664 S 0 1.8 0.7 0:04 httpd
> > > 9786 wwwrun 0 0 3974M 5996 5996 2664 S 0 0.0 0.7 0:04 httpd
> > > 9784 wwwrun 0 0 3974M 5980 5980 2664 S 0 0.0 0.7 0:04 httpd
> > > 9759 wwwrun 0 0 3976M 5948 5948 2660 S 0 2.0 0.7 0:04 httpd
> > > 9755 wwwrun 0 0 3974M 5940 5940 2668 S 0 0.0 0.7 0:04 httpd
> > > 9750 wwwrun 0 0 3974M 5928 5928 2656 S 0 0.0 0.7 0:05 httpd
> > > 9783 wwwrun 0 0 3974M 5928 5928 2724 S 0 0.0 0.7 0:04 httpd
> > > 9794 wwwrun 0 0 3974M 5920 5920 2660 S 0 0.5 0.7 0:04 httpd
> > > 9785 wwwrun 0 0 3974M 5904 5904 2668 S 0 0.0 0.7 0:04 httpd
> > > 9802 wwwrun 0 0 3974M 5900 5900 2720 S 0 0.0 0.7 0:04 httpd
> > > 9796 wwwrun 0 0 3974M 5896 5896 2656 S 0 0.0 0.7 0:05 httpd
> > > 9748 wwwrun 0 0 3974M 5884 5884 2652 S 0 0.0 0.7 0:04 httpd
> > > 9789 wwwrun 0 0 3974M 5880 5880 2668 S 0 0.0 0.7 0:05 httpd
> > > 9788 wwwrun 1 0 3974M 5876 5876 2652 S 0 0.9 0.7 0:05 httpd
> > > 9767 wwwrun 0 0 3974M 5864 5864 2728 S 0 0.0 0.7 0:05 httpd
> > >
> > >
> > > Andi Gutmans wrote:
> > >
> > > > Please edit zend_fast_cache.h in the Zend/ directory and a line after
> > > > #define _ZEND_FAST_CACHE_H
> > > > add
> > > > #define ZEND_ENABLE_FAST_CACHE 0
> > > > Also edit zend_alloc.h and change
> > > > MAX_CACHED_MEMORY to 1
> > > > and
> > > > MAX_CACHED_ENTRIES to 1
> > > >
> > > > See if this changes anything.
> > > >
> > > > Andi
> > > >
> > > > On Mon, 13 Mar 2000, Gaylord Aulke wrote:
> > > >
> > > > > hi,
> > > > >
> > > > > we tested a little bit more today and found the following strange
> > > > > phenomenon:
> > > > > we start apache and every httpd uses 0.6% of the available memory
> > > > > (according
> > > > > to "top").
> > > > >
> > > > > while running, this percentage increases step by step. after 6 hours, every
> > > > > httpd
> > > > > uses 1.2% of the available memory. httpd's are started and stopped
> > > > > correctly.
> > > > > we have a minimum of 20 servers, 20 min.spare and 40 max. spare. the number
> > > > > of httpds changes frequently. the size of newly started httpds increases as
> > > > > said above (1.4% now).
> > > > >
> > > > > in my opinion the amount of shared memory the apache processes use
> > > > > increases.
> > > > > does this make sense? can it be PHP?
> > > > >
> > > > > regards,
> > > > > gaylord aulke
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > Andi Gutmans wrote:
> > > > >
> > > > > > Sound strange. There are some inter-request cache's but I
> > > > > > don't think they
> > > > > > are 500KB of size. Although if the size doesn't grow this might
> > > > > > be it. Did
> > > > > > you compile with --disable-debug?
> > > > > >
> > > > > > Andi
> > > > > >
> > > > > > At 11:35 PM 3/12/00 +0100, Gaylord Aulke wrote:
> > > > > > >we are currently analyzing the system to track down the cause of
> > > > > > >the
> > > > > > >memory leak. could also be syslogd or some other component.
> > > > > > >
> > > > > > >the system has an average of 96 HTTPDs open but sometimes this
> > > > > > >number
> > > > > > >increases to 230 for a few seconds.
> > > > > > >
> > > > > > >the machine has 768MB RAM. after apache is running for a few
> > > > > > >minutes, it
> > > > > > >starts
> > > > > > >allocating more and more memory. 500-1000 KB in 5 seconds are
> > > > > > >allocated
> > > > > > >and not freed until apache is shut down.
> > > > > > >
> > > > > > >we switched back to PHP3 for now but start our 3rd PHP4-Approach
> > > > > > >tomorrow.
> > > > > > >maybe we have more info then...
> > > > > > >
> > > > > > >gaylord aulke
> > > > > > >agi, stuttgart, germany
> > > > > > >
> > > > > > >PS: (the site's name is ‚…8
> > > > > > >¨™A�¤ŸAbuhttp://www.knowone.de)
> > > > > > >
> > > > > > >Andi Gutmans wrote:
> > > > > > > >
> > > > > > > > Well I'm not saying it isn't PHP but the fact that
> > > > > > > > it's Beta doesn't mean
> > > > > > > > much. We're actually quite close to a release candidate
> > > > > > > > within a few weeks.
> > > > > > > > PHP frees every requests memory automatically (even if the
> > > > > > > > internal engine
> > > > > > > > leaks) at the end of each request. Of course there could be
> > > > > > > > a leak
> > > > > > > > somewhere as there are some places which don't use the
> > > > > > > > special memory
> > > > > > > > manager but it would probably be a pretty isolated case.
> > > > > > > > The only way we can debug your problem is if we have enough
> > > > > > > > information as
> > > > > > > > to when it happens. I'm aware it is hard for you to
> > > > > > > > track this problem
> > > > > > > down.
> > > > > > > > By the way, do the httpd's keep on growing and growing?
> > > > > > > > Or do they
> > > > > > > > stabilize at a certain size?
> > > > > > > >
> > > > > > > > Andi
> > > > > > > >
> > > > > > > > At 02:20 AM 3/11/00 +0100, Gaylord Aulke wrote:
> > > > > > > > >hmmm. i try to find out which script causes the mem
> > > > > > > > >leak. it seems to
> > > > > > > > >happen only with concurrent request. we had no probs
> > > > > > > > >with our
> > > > > > > > >inhouse test system. i am not even sure if it is php
> > > > > > > > >that causes
> > > > > > > > >the memory loss but it's the only beta-software on
> > > > > > > > >the system...
> > > > > > > > >
> > > > > > > > >persistent connections did not work with my system
> > > > > > > > >configuration,
> > > > > > > > >so i use regular connects.
> > > > > > > > >
> > > > > > > > >gaylord aulke
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >Andi Gutmans wrote:
> > > > > > > > > >
> > > > > > > > > > As the script memory is completely freed after
> > > > > > > > > > each request this
> > > > > > > might have
> > > > > > > > > > something to do with the ODBC/Adabas support
> > > > > > > > > > you're using.
> > > > > > > > > > Are you using persistent connections?
> > > > > > > > > > Is there any chance you can find the script which
> > > > > > > > > > is causing this
> > > > > > > trouble
> > > > > > > > > > and cut it down as much as possible?
> > > > > > > > > >
> > > > > > > > > > Andi
> > > > > > > > > >
> > > > > > > > > > At 11:35 PM 3/10/00 +0100, Gaylord Aulke wrote:
> > > > > > > > > > >here my report:
> > > > > > > > > > >we compiled and built the current cvs and
> > > > > > > > > > >after that, the error did
> > > > > > > > > not occur
> > > > > > > > > > >anymore.
> > > > > > > > > > >the memory leak that brings my server down has
> > > > > > > > > > >increased by at least a
> > > > > > > > > > >factor of
> > > > > > > > > > >two after installing the new build.
> > > > > > > > > > >
> > > > > > > > > > >we switched back to php3.0.15 for now.
> > > > > > > > > > >
> > > > > > > > > > >gaylord aulke
> > > > > > > > > > >
> > > > > > > > > > >Gaylord Aulke wrote:
> > > > > > > > > > >
> > > > > > > > > > > > Okay, we are working on it.
> > > > > > > > > > > > in the meantime we changed the script so
> > > > > > > > > > > > that it frees all
> > > > > > > > > odbc-results and
> > > > > > > > > > > > closes the connection but the error
> > > > > > > > > > > > still occurs.
> > > > > > > > > > > >
> > > > > > > > > > > > but the memory leak is much bigger than
> > > > > > > > > > > > reported by this error
> > > > > > > message.
> > > > > > > > > > > > i think we currently have 100-200
> > > > > > > > > > > > php-requests/minute and lose
> > > > > > > > > 500KB every
> > > > > > > > > > > > 5-6 seconds.
> > > > > > > > > > > >
> > > > > > > > > > > > if you need more info to locate the
> > > > > > > > > > > > problem, please send me an
> > > > > > > email. i
> > > > > > > > > > > > can do some checks now on the running
> > > > > > > > > > > > system with 280 users on it.
> > > > > > > > > > > >
> > > > > > > > > > > > regards,
> > > > > > > > > > > > gaylord aulke
> > > > > > > > > > > >
> > > > > > > > > > > > Andi Gutmans wrote:
> > > > > > > > > > > >
> > > > > > > > > > > > > Can you please try and update your
> > > > > > > > > > > > > Zend CVS tree and see if I
> > > > > > > > > managed to
> > > > > > > > > > > > > fix the problem. I think I have
> > > > > > > > > > > > > found a leak but I'm not sure
> > > > > > > this is
> > > > > > > > > > > what
> > > > > > > > > > > > > effected you.
> > > > > > > > > > > > >
> > > > > > > > > > > > > Andi
> > > > > > > > > > > > >
> > > > > > > > > > > > > At 10:21 PM 3/10/00 +0100, Gaylord
> > > > > > > > > > > > > Aulke wrote:
> > > > > > > > > > > > > >hi,
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >we have exactly the same
> > > > > > > > > > > > > >problem. our apache keeps leaking
> > > > > > > > > > > > > >memory. 500 MB in 2 Hours! And
> > > > > > > > > > > > > >then the system swaps
> > > > > > > > > > > > > >and dies.
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >PHP4, CVS-Version 03/10/2000
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >message from error-log:
> > > > > > > > > > > > > >zend_operators.c(741) :
> > > > > > > > > > > > > >Freeing 0x08399DFC (3 bytes),
> > > > > > > > > > > > >
> > > > > > > > > > > > > >>script=/home/www/knowone4/daheim/anzeige_aufgeben.php
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >this message arrises every 20
> > > > > > > > > > > > > >seconds.
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >we are using ODBC/ADABAS and
> > > > > > > > > > > > > >sessions. the same scripts
> > > > > > > > > > > > > >work fine with the same apache
> > > > > > > > > > > > > >and php3.
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >anyone got an idea?
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >btw: we are not freeing our
> > > > > > > > > > > > > >odbc-results and connections. can
> > > > > > > > > > > > > >this be the problem?
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >regards,
> > > > > > > > > > > > > >gaylord aulke
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >Teodor Cimpoesu wrote:
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > > ./zend_execute.c(1695) :
> > > > > > > > > > > > > > > Freeing 0x0818C8AC (12 bytes),
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > script=/opt/apache.fuel/htdocs/phorum/index.php
> > > > > > > > > > > > > > > ./zend_execute.c(1695) :
> > > > > > > > > > > > > > > Freeing 0x0814C20C (12 bytes),
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > script=/opt/apache.fuel/htdocs/phorum/index.php
> > > > > > > > > > > > > > > ./zend_execute.c(1695) :
> > > > > > > > > > > > > > > Freeing 0x08154DD4 (12 bytes),
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > script=/opt/apache.fuel/htdocs/phorum/index.php
> > > > > > > > > > > > > > > ./zend_execute.c(1695) :
> > > > > > > > > > > > > > > Freeing 0x0815E05C (12 bytes),
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > script=/opt/apache.fuel/htdocs/phorum/index.php
> > > > > > > > > > > > > > > (CVS snapshot of few
> > > > > > > > > > > > > > > minutes ago)
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > The page producing this
> > > > > > > > > > > > > > > is the index.php from phorum3.0.8
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > --
> > > > > > > > > > > > > > > CIMPOESU Teodor, Web
> > > > > > > > > > > > > > > Programmer
> > > > > > > > > > > > > > > @ DIGICOM S.A.
> > > > > > > > > > > > > > > Bucharest, Romania
> > > > > > > > > > > > > > > @ Internet, site
> > > > > > > > > > > > > > > development
> > > > > > > > > > > > > > > @ see
> > > > > > > > > > > > > > > http://internet.digiro.net/
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > --
> > > > > > > > > > > > > > > PHP 4.0 Beta Mailing List
> > > > > > > > > > > > > > > <http://www.php.net/version4/>
> > > > > > > > > > > > > > > To unsubscribe, e-mail:
> > > > > > > > > > > > > > > php4beta-unsubscribe@lists.php.net
> > > > > > > > > > > > > > > For additional commands,
> > > > > > > > > > > > > > > e-mail: php4beta-help@lists.php.net
> > > > > > > > > > > > > > > To contact the list
> > > > > > > > > > > > > > > administrators, e-mail:
> > > > > > > > > > > php4beta-admin@lists.php.net
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >--
> > > > > > > > > > > > > >PHP 4.0 Beta Mailing List
> > > > > > > > > > > > > ><http://www.php.net/version4/>
> > > > > > > > > > > > > >To unsubscribe, e-mail:
> > > > > > > > > > > > > >php4beta-unsubscribe@lists.php.net
> > > > > > > > > > > > > >For additional commands,
> > > > > > > > > > > > > >e-mail: php4beta-help@lists.php.net
> > > > > > > > > > > > > >To contact the list
> > > > > > > > > > > > > >administrators, e-mail:
> > > > > > > > > php4beta-admin@lists.php.net
> > > > > > > > > > > > >
> > > > > > > > > > > > > ---
> > > > > > > > > > > > > Andi Gutmans <andi@zend.com>
> > > > > > > > > > > > >
> > > > > > > > > > > > > http://www.zend.com/
> > > > > > > > > > > > >
> > > > > > > > > > > > > --
> > > > > > > > > > > > > PHP 4.0 Beta Mailing List
> > > > > > > > > > > > > <http://www.php.net/version4/>
> > > > > > > > > > > > > To unsubscribe, e-mail:
> > > > > > > > > > > > > php4beta-unsubscribe@lists.php.net
> > > > > > > > > > > > > For additional commands, e-mail:
> > > > > > > > > > > > > php4beta-help@lists.php.net
> > > > > > > > > > > > > To contact the list administrators,
> > > > > > > > > > > > > e-mail:
> > > > > > > > > php4beta-admin@lists.php.net
> > > > > > > > > > > >
> > > > > > > > > > > > --
> > > > > > > > > > > > PHP 4.0 Beta Mailing List
> > > > > > > > > > > > <http://www.php.net/version4/>
> > > > > > > > > > > > To unsubscribe, e-mail:
> > > > > > > > > > > > php4beta-unsubscribe@lists.php.net
> > > > > > > > > > > > For additional commands, e-mail:
> > > > > > > > > > > > php4beta-help@lists.php.net
> > > > > > > > > > > > To contact the list administrators,
> > > > > > > > > > > > e-mail:
> > > > > > > > > php4beta-admin@lists.php.net
> > > > > > > > > >
> > > > > > > > > > ---
> > > > > > > > > > Andi Gutmans <andi@zend.com>
> > > > > > > > > >
> > > > > > > > > > http://www.zend.com/
> > > > > > > >
> > > > > > > > ---
> > > > > > > > Andi Gutmans <andi@zend.com>
> > > > > > > > http://www.zend.com/
> > > > > >
> > > > > > ---
> > > > > > Andi Gutmans <andi@zend.com>
> > > > > > http://www.zend.com/
> > > > >
> > >
>