httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ed <ed-h...@s5h.net>
Subject Re: timeout on request handler
Date Thu, 18 Oct 2007 17:03:26 GMT
On Thu, 18 Oct 2007 16:05:37 +0200
"Gabriel Pap" <paco@gulo.sk> wrote:

> I need to abort the request handler in my module after a timeout.
> What is the proper way to do it? Do I have to poll for the current
> time? How can I set an alarm?
> 
> request_handler(request_rec* r) {
> ...
> 
> while () {
> 
>   .. do some time demanding processing
>   if (timeout)
>     return HTTP_SERVICE_TEMPORARY_UNAVAILABLE; // or whatever
> 
>   }
> 
> ...
> 
> }

I'm quite new to Apache modules, but if you set an alarm the signal
will go to the whole process and possibly kill it, which is probably
not what a busy server would want.

It would be better, if your work has a blocking read, to use select(),
and as you suggest, probably the time(), to leave the loop when the
time has exceeded and tell apache to return a 500 or something.

-- 
The dirt trail to the playstation is down because of a screwed
up .procmailrc file. RedHat is wished well in their future endeavors.
:: http://www.s5h.net/ :: http://www.s5h.net/gpg

Mime
View raw message