[Catalyst] code after finalize: mod_perl, testserver ok - fastcgi not

Bill Moseley moseley at hank.org
Sat Apr 7 14:20:55 GMT 2007

On Sat, Apr 07, 2007 at 11:00:19AM +0200, Josef Chladek wrote:
> we try to execute some long running code after finishing the request,
>     $c->response->content_type('text/html; charset=utf-8');
>     $c->res->body('blabla...');
>     $c->response->status(200);
>     $c->finalize;
>     $c->forward('very_long_running_code');
> while this works perfectly when running the testserver or under  
> mod_perl, it won't work when used with apache and
> FastCgiExternalServer  /usr/local/www/catalyst/Xatalyst/script/ 
> xatalyst_fastcgi.pl -flush -host

I think the standard answer is don't do that. ;)  Can you stuff the
data someplace and send a message to another non-web process to
handle the work?

I have not done this in years but, IIRC, I would fork, open STDIN and
STDOUT to /dev/null, and then call setsid().

It's interesting this is working for you with mod_perl if you are not
doing the above.  But, again, it's been years since I did this.

Hopefully, someone with a bit more knowledge of FastCGI can respond.

Bill Moseley
moseley at hank.org

More information about the Catalyst mailing list