in reply to CGI::Fast / Apache - Strange behaviour?
This behavior isn’t “strange” ... I think you hit the nail on the head as to its cause and the general remedy. I have not yet personally used CGI::Fast, preferring instead to use Plack, but it does indeed appear to me that your FastCGI processes are crashing, after which they are necessarily being re-spawned. A completely unhandled exception will cause any script to die, so this outcome must be prevented, because the causes of exceptions in production code cannot. I think that the entirely-correct strategy is to wrap the body of that while loop inside of an exception-handling block, e.g. eval, so that any exception, no matter what the cause, will be explicitly trapped and some traceback given in a log. (You may have to write code to do this.) I am frankly puzzled why the examples for CGI::Fast do not include some kind of exception handling. In general, the synopsis given seems simplistic, although I’m sure the code works well.
As I said, I customarily use include Plack, and, unrelated to that, part of the standard preamble for my modules is this:
use Try::Tiny;
use Exception::Class;
use Exception::Caught;
use except::classes; // a set of app-specific exception classes
use Error::Return;
You may wish to peruse some of these. HTH...
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: CGI::Fast / Apache - Strange behaviour?
by DreamT (Pilgrim) on Aug 16, 2012 at 12:29 UTC |