You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "Purcell, Scott" <sp...@ltcgroup.com> on 2001/06/19 22:27:10 UTC

Cached Code Disappeared?

Hello,
Still seeking assistance form anyone who is experienced with sockets and
mod-perl /apache on NT.

Anyway, as my previous email showed, I built a site which used a global
filehandle to a socket. It worked great for about two hours, and then all of
a sudden stopped. After rebooting the apache server, all worked well again. 

I am thinking that the cached code probably went away since no one hit it
for a while? Does apache give back cached scripts after a certain time of
not being used?

And if that is the case, can I tell the server via the config that I want
to keep a certain script or perl module alive in cache for a set time?

Thanks

Scott Purcell


Re: Cached Code Disappeared?

Posted by Perrin Harkins <pe...@elem.com>.
> Still seeking assistance form anyone who is experienced with sockets and
> mod-perl /apache on NT.

No NT here, but...

> Anyway, as my previous email showed, I built a site which used a global
> filehandle to a socket. It worked great for about two hours, and then all
of
> a sudden stopped. After rebooting the apache server, all worked well
again.
>
> I am thinking that the cached code probably went away since no one hit it
> for a while? Does apache give back cached scripts after a certain time of
> not being used?

Not exactly.  An apache child process will eventually die if there's nothing
to keep it busy, but at least one process will always remain, and on Windows
there is always exactly one at any given time (with mod_perl).  If you're
using MaxRequestsPerChild or Apache::SizeLimit or something similar, the
process will eventually be killed and a new one will take it's place,
meaning that code cached during startup.pl/httpd.conf will still be cached
but anything cached in that child will be gone.

You probably don't want to try and change this behavior, since it keeps
processes from growing too large.  However, you should make sure that you
aren't trying to open a socket (or filehandle, or database handle) in the
parent process (during startup) and use it in the children.  Each child will
have to make a new socket the first time.

Hope that helps,
Perrin