You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by mm...@workzoo.com on 2002/08/28 11:15:10 UTC

$r->print() with slow clients and stop button

Hi,

I've created a meta-search that prints out status messages to 
the browser as it receives responses from the servers it is searching by
setting $|=1 and using $r->print. It runs as a mod_perl handler. I'm running
apache 1.3.24 and mod_perl 1.26 on Linux. 

I'm finding that my web app has slowed down radically since I started doing
this. I've tracked it down to the $r->print statements. I suspect that each
statement is waiting for acknowledgement from the client before it will
continue execution. Sometimes children are tied up for 2 minutes! I suspect
these may be where the client has dropped its dialup connection and
$r->print is waiting for acknowledgement of a packet. 

Has anyone else had this problem? I've set httpd.conf's Timeout setting to 5
seconds as a temporary fix. As I understand it, this will affect the amount
of time perl waits before triggering soft_timeout or hard_timeout when doing
$r->print operations?

I'd like to somehow send data to the client and have execution continue until 
the end of a time critical section, after which it will wait for acknowledgement 
of all data that was sent and if that is not received within X seconds, kill
the connection and return OK.

The only way I can think of doing this is to get the client socket
connection, temporarily change it to non blocking, do a send on it, finish
the piece of code, and then change it back to non-blocking once I've
confirmed the data was sent correctly. I'm afraid (very afraid) that this
will break apache or mod_perl somehow. Does this sound like a workable
solution? My C isn't too hot, so I'll be coding the entire thing in Perl and
running it as part of the handler. 

Is there a better or easier way to do this?

thanks,

~mark
http://www.workzoo.com/
<ma...@workzoo.com>

Re: $r->print() with slow clients and stop button

Posted by Stas Bekman <st...@stason.org>.
[...]

> I'd like to somehow send data to the client and have execution continue until 
> the end of a time critical section, after which it will wait for acknowledgement 
> of all data that was sent and if that is not received within X seconds, kill
> the connection and return OK.

http://perl.apache.org/docs/1.0/guide/debug.html#Handling_the__User_pressed_Stop_button__case

[...]


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com