You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Stefan Thuering <st...@freesurf.ch> on 2003/09/29 19:28:52 UTC

[MP1] memory leak when PerlSetupEnv is enabled (win32)

Platform: NT4 SP6, Apache 1.3.27/28, mod_perl 1.28, perl 5.6.1
Scenario: When running any script (print hello...) multiple times memory 
usage of apache slowly grows (maybe 400byte/request)

Apache Setting:
ScriptAlias /perl/ "E:/Apache/cgi-bin/"
<Location /perl>
  SetHandler perl-script
  PerlHandler Apache::Registry
#PerlSetupEnv Off
  Options ExecCGI
</Location>

I found out that if you set "PerlSetupEnv Off" then the leaking stops!!!
But I also lose the Apache ENV vars :(

--- quote from mod_perl documentation ---
The last thing Apache::Registry does, is emulation of mod_cgi's 
environment variables, like $ENV{SERVER_NAME}, $ENV{REMOTE_USER} and so 
on. PerlSetupEnv Off disables this feature which saves some memory and 
CPU cycles.
-----------------------------------------

I think mod_perl generates the ENV hash every time a script is run and 
doesn't free up the memory afterwards...

This person seems to have the same problem:
http://groups.google.com/groups?selm=3EE62CB3.935AD041%40news.com
(win2k mod_perl 1.27_01 apache 1.3.27)

thanks

-- 
homepage http://my.animeweb.org


Re: [MP1] memory leak when PerlSetupEnv is enabled (win32)

Posted by Stas Bekman <st...@stason.org>.
Stefan Thuering wrote:
> Platform: NT4 SP6, Apache 1.3.27/28, mod_perl 1.28, perl 5.6.1
> Scenario: When running any script (print hello...) multiple times memory 
> usage of apache slowly grows (maybe 400byte/request)
> 
> Apache Setting:
> ScriptAlias /perl/ "E:/Apache/cgi-bin/"
> <Location /perl>
>  SetHandler perl-script
>  PerlHandler Apache::Registry
> #PerlSetupEnv Off
>  Options ExecCGI
> </Location>
> 
> I found out that if you set "PerlSetupEnv Off" then the leaking stops!!!
> But I also lose the Apache ENV vars :(

You don't lose Apache ENV vars, you loose mod_cgi-emulation ENV vars. You can 
still access them via various mod_perl methods. You could also try to call 
$r->subprocess_env, at the very beginning of your handlers/scripts, but I 
don't know if it's going to make any difference leakage-wise.

> --- quote from mod_perl documentation ---
> The last thing Apache::Registry does, is emulation of mod_cgi's 
> environment variables, like $ENV{SERVER_NAME}, $ENV{REMOTE_USER} and so 
> on. PerlSetupEnv Off disables this feature which saves some memory and 
> CPU cycles.
> -----------------------------------------

That was incorrect information. Apache::Registry doesn't do that. 'SetHandler 
perl-script' does that. It "was" because I've just removed that para from 
intro.pod ;)

> I think mod_perl generates the ENV hash every time a script is run and 
> doesn't free up the memory afterwards...
> 
> This person seems to have the same problem:
> http://groups.google.com/groups?selm=3EE62CB3.935AD041%40news.com
> (win2k mod_perl 1.27_01 apache 1.3.27)

This is quite possible, since I doubt mod_perl 1.0 is used much in production 
on windows, so bugs are more than likely. Someone on winFU needs to debug 
this. Alternatively try mod_perl 2.0, which is scalable on winFU.


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com