mod_perl 1: Apache::print() and timeouts

  • Thread starter Nicholas Oxhøj
  • Start date
N

Nicholas Oxhøj

Hi

I recently posted the below question on both the mod_perl Users mailing
list and the mod_perl Development mailing list, but with no response.
So now I hope that some insightful people on this newsgroup will care
to comment...

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
 
B

Big and Blue

Nicholas said:
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.

I've always sent back HTML comments ever few minutes for Web pages
which take a long time to return real results (which is a very unusual
case). This is more to keep the *client browser* interested than the
Apache server though, since in my experience the browser gives up within a
few minutes.
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?

But I've never done this in mod_perl, only in Perl CGI scripts. (Set
stdout to autoflush(), set an alarm for 1 minute, if it goes off write a
short HTML comment and set another alarm).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,119
Latest member
IrmaNorcro
Top