On Sat, Jan 05, 2008 at 12:21:07PM -0800, Kate Yoak wrote: > > > Hi, while testing the PerlCleanupHandler in HTML::Mason: > > > > <%init> > > $r->push_handlers(PerlCleanupHandler => \&sleeptest); > > > > sub sleeptest { > > my $r = shift; > > $r->warn("BEFORE SLEEP"); > > sleep(10); > > $r->warn("AFTER SLEEP"); > > }; > > </%init> > > > > I've noticed that the page only finishes loading after the > > PerlCleanupHandler has completely executed. A per the > > documentation the cleanup is code is supposed to happen after > > the client is gone, not while he's waiting. > > I became curious and tested this by registering a PerlCleanupHandler > directly in apache. Documentation is correct - content was served before the > cleanup handler. > > I know Mason quite well but I can't find any explanation for what you are > seeing... I know they try to delay sending content until the last possible > moment to ensure that any and all headers make it in. But I don't see how > they'd make it past the content phase. Mason has an excellent mailing list, > btw - somewhere on masonhq.com. May be somebody can make sense of it there!
Actually someone on mason-users pointed me in the right direction: KeepAlive on is the culprit. Turning it to off solves the problem. Now what are the pros/cons of using KeepAlive in a mod_perl environement? Is it possible to turn it off only for certain requests? Thanks,