Mike Blancas wrote:
> 
> Hi,
> 
> I have this bug/problem with Apache ASP. The caching of subs doesn't uses
> the same memory space for different virtual hosts. Lets say I have three
> virtual hosts all are using a sub called print_header and print_footer.
> These subs have different content on their print_header and print_footer.
> Problem is sometimes one of the virtual hosts uses the cached print_header
> of another virtual host, resulting in a not so sightly result. One of my
> solution is just to rename the sub, but what if a client names his sub the
> same as another client's sub. I think this is not a memory problem since
> my box has 2GB of physical memory.
> 

If print_header() is defined in a script or include, then all
you need to do is have each client have a unique Global, 
since the print_header() will be compiled into the GlobalPackage
namespace, by default defined to be the Global directory.

If they have the same Global, then you can try to circumvent
this problem by setting 

  PerlSetVar UniquePackages 1

http://www.apache-asp.org/config.html#UniquePackages
Each script will get its own namespace then.

But this can always be a problem because of how mod_perl
is set up.  Let's say you have a package Site and in it 
you have print_header()... this print_header will be 
everyones Site::print_header() because the perl interpreter
is being shared across requests for various clients.

A cleaner way to run mod_perl for many people is to have
a separate mod_perl server for EACH party running on a 
high port ( > 1024 ) and have your root httpd on port 80 
configured to forward requests for those domains to those 
servers on the backend using ProxyPass/ProxyPassReverse 
settings.

Another thing you might try is to have MaxRequestsPerChild
set to 1.  This will be incredibly inefficient, but it will
at least keep the perl namespace clean.  This would still
be better than CGI perl because you can cache module
compilations like Apache::ASP with the PerlModule directive...
so then you could put all your ASP VirtualHosts on some high
port backend server, and just ProxyPass to those, leaving
your gif requests & such to be served at the front end.

Sorry if none of these seems nice, but I don't think mod_perl
was meant to be used in a VirtualHost environment where
multiple untrusted parties can modify the code.  People
talk about modperl/apache 2.0 being better at this because
of having the ability for separate perl interpreters per
VirtualHost, but we'll see when these are released as stable.

--Josh
_________________________________________________________________
Joshua Chamas                           Chamas Enterprises Inc.
NodeWorks Founder                       Huntington Beach, CA  USA 
http://www.nodeworks.com                1-714-625-4051

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to