httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Hartill <>
Subject mod_perl and exit
Date Thu, 31 Jul 1997 00:49:05 GMT

People have also found a need to let mod_perl 'scripts' call
exit in order to recover huge amounts of memory.

It's very easy to write Perl code under mod_perl to deliberately
consume lots of memory to get a job done quickly. There's no effective
way to recover memory used by Perl other than to nuke the process.
If you're lucky you can wait for the process to serve all its allocated
requests then die a natural death, but if you're short on memory then
its a blessing to have a way to self destruct the process.

You might not like that way of programming but it comes in very handy
for big mod_perl projects.

Another use for exit in mod_perl (dunno if it's still necessary) was
as a way to jump out of deep layers of subroutine calls. Calling
GOTO out of a subroutine just confuses the hell out of "mod_perl"
(I think the problem was to do with the stack pointer being way off
after the jump). The code can be rewritten to allow
graceful "return"s from these subroutine calls but sometimes
it's not your code or it's part of some module you just can't
touch or ...

I had to rewrite my code to return from dead-ends deep in a chain
of subroutines, but until I finished that, 'exit' was the solution. At
least one other mod_perl user reported getting into the same situation.
If you have big CGI scripts, chances are you'll hit this problem porting
them to mod_perl.

Rob Hartill                              Internet Movie Database (Ltd)   .. a site for sore eyes.

View raw message