You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Katherine Spice <k....@acu.ac.uk> on 2004/07/08 18:49:35 UTC

CLEANUP subroutine delaying response

Hi,

I have an embperl page that does some stuff, and then spits out a
redirect using $http_headers_out{'Location'}. From
http://perl.apache.org/embperl/pod/doc/Embperl.-page-4-.htm it was my
understanding that any code I defined in a CLEANUP subroutine would be
run after the response was sent to the client, however when I've tested
it by putting in the page  [! sub CLEANUP { sleep 15; } !] the redirect
isn't issued for 15 seconds. Please would somebody take pity on me and
explain what I'm missing?

Thanks,
Katherine

FWIW I'm using Embperl 2.0b9, with Embperl::Object as the PerlHandler on
Apache 1.3.27 with mod_perl 1.26.



---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: CLEANUP subroutine delaying response

Posted by Gerald Richter <ri...@ecos.de>.
Hi,

>
> I'm (very) relieved to report that setting Embperl_Debug to 256 does
> allow the http header to be sent before the CLEANUP sub is finished.

Great!

> If there's anything else I can test to help you fix this please let
> me know.
>

I try to fix it as soon as I get a little free time ...

I let you know when it is done

Gerald


---------------------------------------------------------------------------
Gerald Richter            ecos electronic communication services gmbh
IT-Securitylösungen * Webapplikationen mit Apache/Perl/mod_perl/Embperl

Post:       Tulpenstrasse 5          D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de          Voice:   +49 6133 939-122
WWW:        http://www.ecos.de/      Fax:     +49 6133 939-333
---------------------------------------------------------------------------
ECOS BB-5000 Firewall- und IT-Security Appliance: www.bb-5000.info
---------------------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: CLEANUP subroutine delaying response

Posted by Katherine Spice <k....@acu.ac.uk>.
Hi Gerald,

> You don't miss anything. The docs describes how it should be and how it was
> in Embperl 1.3. This behaviour seems to be broken in 2.0. To verify this
> could just try to set the dbgFlushOutput flag in Embperl_Debug. Does this
> change anything (other than the fact that everything gets slower)?
> 
> If yes, I should be able to fix it.

I'm (very) relieved to report that setting Embperl_Debug to 256 does
allow the http header to be sent before the CLEANUP sub is finished. If
there's anything else I can test to help you fix this please let me know.

Thank you!

Katherine


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: CLEANUP subroutine delaying response

Posted by Gerald Richter <ri...@ecos.de>.
> Hi,
>
> I have an embperl page that does some stuff, and then spits out a
> redirect using $http_headers_out{'Location'}. From
> http://perl.apache.org/embperl/pod/doc/Embperl.-page-4-.htm it was my
> understanding that any code I defined in a CLEANUP subroutine would be
> run after the response was sent to the client, however when I've
> tested it by putting in the page  [! sub CLEANUP { sleep 15; } !] the
> redirect isn't issued for 15 seconds. Please would somebody take pity
> on me and explain what I'm missing?
>

You don't miss anything. The docs describes how it should be and how it was
in Embperl 1.3. This behaviour seems to be broken in 2.0. To verify this
could just try to set the dbgFlushOutput flag in Embperl_Debug. Does this
change anything (other than the fact that everything gets slower)?

If yes, I should be able to fix it.

Regards

Gerald



---------------------------------------------------------------------------
Gerald Richter            ecos electronic communication services gmbh
IT-Securitylösungen * Webapplikationen mit Apache/Perl/mod_perl/Embperl

Post:       Tulpenstrasse 5          D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de          Voice:   +49 6133 939-122
WWW:        http://www.ecos.de/      Fax:     +49 6133 939-333
---------------------------------------------------------------------------
ECOS BB-5000 Firewall- und IT-Security Appliance: www.bb-5000.info
---------------------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: CLEANUP subroutine delaying response

Posted by Ed Grimm <ed...@dsblade00.wat.us.ray.com>.
My suspicion is that the CLEANUP routine is called after the response to
the client is put into the output buffer, but before the output buffer
is flushed.  As redirects are always fairly short, the redirect fits
entirely within one buffer in this case, and so nothing has been sent to
the client yet, even though all other processing has finished.

I'm using Embperl 1.3.4, so I can't say for certain this is what is
happening, but I do notice something similar on pages that have an
extended cleanup process - the tail of the page doesn't show up until
that process finishes.  I haven't complained about this, as this
condition only occurs on some of my test pages.

Ed

On Thu, 8 Jul 2004, Katherine Spice wrote:

> Hi,
>
> I have an embperl page that does some stuff, and then spits out a
> redirect using $http_headers_out{'Location'}. From
> http://perl.apache.org/embperl/pod/doc/Embperl.-page-4-.htm it was my
> understanding that any code I defined in a CLEANUP subroutine would be
> run after the response was sent to the client, however when I've tested
> it by putting in the page  [! sub CLEANUP { sleep 15; } !] the redirect
> isn't issued for 15 seconds. Please would somebody take pity on me and
> explain what I'm missing?
>
> Thanks,
> Katherine
>
> FWIW I'm using Embperl 2.0b9, with Embperl::Object as the PerlHandler on
> Apache 1.3.27 with mod_perl 1.26.

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org