exit — terminate execution and child process
Replaces Tcl's exit core command. ::rivet::exit interrupts execution of the current script and passes execution to AbortScript if such script is set. After AbortScript has finished and request processing completed the child process is forced to exit by calling Tcl_Exit producing the same final effect of the core command. During an AbortScript execution the exit condition can be detected
if {[::rivet::abort_page -exiting]} {
...handle exit condition
}
::rivet::exit has a single optional argument ?code?. This value must be a positive integer number to be passed to Tcl_Exit. If any other value is given ?code? is set to 0. The exit code can be obtained from the dictionary returned by ::rivet::abort_code
[::rivet::abort_code]
<== return_code ?code? error_code exit
We support this command in order to have a gentle way to terminate a request processing before actually exit the child process and avoid an abrupt interruption of a request that might leave an application in a inconsistent state. In some cases ::rivet::exit could be the only way to exit a process and force the Apache HTTP web server to start a fresh one. Moreover the core exit could be called from third parties software and you may not be aware of it. We thus decided to trap this command and give it the most gentle behavior still preserving its basic purpose.
Note | |
---|---|
Nonetheless we discourage the programmer to use such command, and suggest to focus on proper application design and avoid such a drastic way to bail out. If you need to restart the child processes from time to time we recommend to check the MaxRequests parameter in the prefork MPM documentation or the MaxRequestsPerChild configuration parameter |