Re: Trouble with script execution
Apache2::Reload Regards, Jie * Worik Stanton worik.stan...@gmail.com wrote: Date: Mon, 19 May 2014 13:47:12 +1200 From: Worik Stanton worik.stan...@gmail.com CC: mod_perl list modperl@perl.apache.org Subject: Re: Trouble with script execution User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 On 19/05/14 12:13, Brad Van Sickle wrote: Yep you need to restart to see your changes. I am sure I read somewhere that mod_perl monitors scripts and reloads them if the modification date changes. But oh well. It definitely notices sometimes. cheers Worik -- The only true evil is turning people into things Granny Weatherwax worik.stan...@gmail.com 021-1680650, (03) 4821804 Aotearoa (New Zealand)
Re: Trouble with script execution
On Sun, May 18, 2014 at 9:47 PM, Worik Stanton worik.stan...@gmail.com wrote: I am sure I read somewhere that mod_perl monitors scripts and reloads them if the modification date changes. You're probably thinking of Apache::Registry/ModPerl::Registry. They do that with your CGI scripts. - Perrin
Trouble with script execution
I am having a nproblem executing my handler. The short of it is it is when I make a change to the script I have to restart the server to get it noticed, and it does not always call the same code. The lng of it: I have a package with a 'handler' function. It starts... package Apache::Script; use strict; use Apache2::Const qw(:common); use Apache2::Connection; [snip] sub handler { warn Apache::Script::handler $$ '.join(, , @_).'; my $r = shift; [snip] Many more lines like... warn Apache::Script::handler; And in the config file: Location /Script SetHandler perl-script PerlResponseHandler Apache::Script /Location Repeatedly loading the URL I get different results almost every time. With the first 'warn' statement producing oyutput almst every iteration and occasionally the later warn statements not being executed, and often with no output. Making changes t the script (adding debugging 'warn' statements) are only reliably (ish) noticed if I restart the server. There is some unreliability in my code (bugs) I am trying to track down but it is confounded by the fact I am not sure what mod_perl is doing. There seems to be a time element. After restarting the server everything goes well for a while (minutes) but soon behaviour changes and I am back to only some of the code executing (with no oither changes but the passing of time). I thought mod_perl would reload code that changed. Is this wrong? Worik -- The only true evil is turning people into things Granny Weatherwax worik.stan...@gmail.com 021-1680650, (03) 4821804 Aotearoa (New Zealand) signature.asc Description: OpenPGP digital signature
Re: Trouble with script execution
No, you have to restart the server for code changes to be noticed. On May 18, 2014 6:48 PM, Worik Stanton worik.stan...@gmail.com wrote: I am having a nproblem executing my handler. The short of it is it is when I make a change to the script I have to restart the server to get it noticed, and it does not always call the same code. The lng of it: I have a package with a 'handler' function. It starts... package Apache::Script; use strict; use Apache2::Const qw(:common); use Apache2::Connection; [snip] sub handler { warn Apache::Script::handler $$ '.join(, , @_).'; my $r = shift; [snip] Many more lines like... warn Apache::Script::handler; And in the config file: Location /Script SetHandler perl-script PerlResponseHandler Apache::Script /Location Repeatedly loading the URL I get different results almost every time. With the first 'warn' statement producing oyutput almst every iteration and occasionally the later warn statements not being executed, and often with no output. Making changes t the script (adding debugging 'warn' statements) are only reliably (ish) noticed if I restart the server. There is some unreliability in my code (bugs) I am trying to track down but it is confounded by the fact I am not sure what mod_perl is doing. There seems to be a time element. After restarting the server everything goes well for a while (minutes) but soon behaviour changes and I am back to only some of the code executing (with no oither changes but the passing of time). I thought mod_perl would reload code that changed. Is this wrong? Worik -- The only true evil is turning people into things Granny Weatherwax worik.stan...@gmail.com 021-1680650, (03) 4821804 Aotearoa (New Zealand)
Re: Trouble with script execution
On 19/05/14 11:34, John Dunlap wrote: No, you have to restart the server for code changes to be noticed. Does that mean I have to restart my server for every change to a script? Worik -- The only true evil is turning people into things Granny Weatherwax worik.stan...@gmail.com 021-1680650, (03) 4821804 Aotearoa (New Zealand) signature.asc Description: OpenPGP digital signature
Re: Trouble with script execution
Yep you need to restart to see your changes. Believe it or not, that's one of the *nice* things about mod_perl. Instead of compiling the code during each execution as PERL does when executed as a purely interpreted language , mod_perl causes each Apache child process to compile the code during it's first request/execution and then caches that compiled version of that code. You will need to restart the web server to clear that cache and force your changes to take effect. This is probably why you're getting inconsistent results after code changes, your seeing some requests that are handled by new child processes that are compiling the latest version of your code and some requests that are being handled by old child processes which are still serving previous versions that they've complied and cached. It may seem inconvenient for you, but this type of caching is a *necessity* when running PERL on any sort of real website that gets an appreciable amount of traffic for performance reasons. There are methods you can employ that tell Apache to automatically reload when it sees code change, pretty easy to find if you dig around the Internet.Although I wouldn't use this in a production system. On 5/18/2014 8:04 PM, Worik Stanton wrote: On 19/05/14 11:34, John Dunlap wrote: No, you have to restart the server for code changes to be noticed. Does that mean I have to restart my server for every change to a script? Worik
Re: Trouble with script execution
On 19/05/14 12:13, Brad Van Sickle wrote: Yep you need to restart to see your changes. I am sure I read somewhere that mod_perl monitors scripts and reloads them if the modification date changes. But oh well. It definitely notices sometimes. cheers Worik -- The only true evil is turning people into things Granny Weatherwax worik.stan...@gmail.com 021-1680650, (03) 4821804 Aotearoa (New Zealand) signature.asc Description: OpenPGP digital signature
Re: Trouble with script execution
That hasn't been my experience. I always need to restart the server. One of the challenges with that is that objects can persist in memory between requests because the perl runtime persists between requests. If the script changes, how do you apply those changes to objects instances which already exist in memory? It is not a simple problem and it exists in other languages(java) as well. Entire companies(ZeroTurnaround) have been built around solving this kind of problem. The only reason that you can make changes in a language like php without a server restart is because php objects cannot persist between requests like they can in perl or Java and that approach has its own disadvantages. On May 18, 2014 9:47 PM, Worik Stanton worik.stan...@gmail.com wrote: On 19/05/14 12:13, Brad Van Sickle wrote: Yep you need to restart to see your changes. I am sure I read somewhere that mod_perl monitors scripts and reloads them if the modification date changes. But oh well. It definitely notices sometimes. cheers Worik -- The only true evil is turning people into things Granny Weatherwax worik.stan...@gmail.com 021-1680650, (03) 4821804 Aotearoa (New Zealand)