JavaScript EditorFree JavaScript Editor     Free JavaScript Scripts 

Main Page Previous Section Next Section

22.4 Shutdown and Restart

When you shut down or restart the server, you may encounter the problems presented in the following sections.

22.4.1 Evil Things Might Happen When Using PerlFreshRestart

Unfortunately, not all Perl modules are robust enough to survive reload. For them this is an unusual situation. PerlFreshRestart does not much more than:

while (my($k,$v) = each %INC) {
    delete $INC{$k};
    require $k;

Besides that, it flushes the Apache::Registry cache and empties any dynamic stacked handlers (e.g., PerlChildInitHandler).

Lots of segfaults and other problems have been reported by users who turned on PerlFreshRestart. Most of them go away when it is turned off. It doesn't mean that you shouldn't use PerlFreshRestart, if it works for you. Just beware of the dragons.

Note that if you have a mod_perl-enabled Apache built as a DSO and you restart it, the whole Perl interpreter is completely torn down (via perl_destruct( )) and restarted. The value of PerlFreshRestart is irrelevent at this point.

22.4.2 [warn] child process 30388 did not exit, sending another SIGHUP

With Apache Version 1.3.0 and higher, mod_perl will call the perl_destruct( ) Perl API function during the child exit phase. This will cause proper execution of any END blocks found during server startup and will also invoke the DESTROY method on global objects that still exist.

It is possible that this operation will take a long time to finish, causing problems during a restart. If you use the apachectl script to restart the server, it sends the SIGHUP signal after waiting for a short while. The SIGHUP can cause problems, since it might disrupt something you need to happen during server shutdown (for example, saving data).

If you are certain that your code does not contain any END blocks or DESTROY methods to be run during child server shutdown, you can avoid the delays by setting the PERL_DESTRUCT_LEVEL environment variable to -1. Be careful, however; even if your code doesn't include any END blocks or DESTROY methods, any modules you use( ) might.

22.4.3 Processes Get Stuck on Graceful Restart

If after doing a graceful restart (e.g, by sending kill -USR1) you see via mod_status or Apache::VMonitor that a process is stuck in state G (Gracefully finishing), it means that the process is hanging in perl_destruct( ) while trying to clean up. If you don't need the cleanup, see the previous section on how to disable it.

    Main Page Previous Section Next Section

    JavaScript EditorJavaScript Validator     Web Manuals and Tutorials