You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Nicholas Oxhøj <mo...@oxhoej.dk> on 2006/02/02 12:51:11 UTC

[mp1] Apache::print() and timeouts

Hi

I recently posted the below question on the mod_perl Users mailing list, 
but now discovered this mod_perl Development mailing list, which might 
be more appropriate for this type of query. Sorry for the cross-posting 
if you receive this twice...

I have some questions regarding mod_perl's implementation of
Apache::print(), especially relating to Apache 1.3's "Timeout" directive.

To start of, if I look at the documentation for the "Timeout" directive
(http://httpd.apache.org/docs/1.3/mod/core.html#timeout):

---
The TimeOut directive currently defines the amount of time Apache will
wait for three things:

    1. The total amount of time it takes to receive a GET request.
    2. The amount of time between receipt of TCP packets on a POST or
PUT request.
    3. The amount of time between ACKs on transmissions of TCP packets
in responses.
---

it seems that for item 2 & 3 this should only timeout on very low-level 
lack of network activity, but browsing the apache 1.3.31 source code, it 
doesn't look like this is how it is used at all. Basically it seems to 
be used like this:

---
ap_soft_timeout("...",r) // start timeout timer

while (more data to send) {
   write_chunk_of_data_to_client();
   ap_reset_timeout(r);  // reset timeout timer
}

ap_kill_timeout(r);     // stop timeout timer
---

which seems as a much more high-level timeout. This is also the way
mod_cgi.c sends the collected output from a CGI script.

When I then look at mod_perl 1.29's implementation of Apache::print() it
seems much worse, since it doesn't do any "chunking" of the data to send
and no one ever calls ap_reset_timeout(r):

---
soft_timeout("...",r) // start timeout timer
Apache::write_client(all data to print)
kill_timeout(r);     // stop timeout timer
---

This seems like a recipe for problems, when mixed with a low Timeout
value and printing of large data, which is exactly the problems I have
been trying to track down the last couple of days.

Does anybody have any comments/info/input on why things are the way they
are? Is it a bug, poor implementation, or am I missing something?

Regards,
Nicholas Oxhøj







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