httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ras...@lerdorf.on.ca (Rasmus Lerdorf)
Subject Re: Spinning httpds - One Solution
Date Fri, 21 Aug 1998 04:54:47 GMT
> r->connection->aborted can and should never ever be set inside a
> hard_timeout.
> 
> The issue is why you don't get a SIGPIPE when writing which would result
> in timout() longjmping out of your code completely.

That is what has puzzled me as well.  My test for this looks like this:

<?
    function done() {
        global $HTTP_USER_AGENT;

        $fp = fopen("/tmp/test.txt","a");
        fputs($fp,$HTTP_USER_AGENT."\n");
        fclose($fp);
    }
    set_time_limit(10);
    register_shutdown_function("done");
    while(1) {
        echo "..................................\n";
        flush();
    }
?>

This basically loops for 10 seconds and when interrupted by the internal
PHP timer it calls the shutdown function named "done" which appends the
user agent to a text file.  Now, if I hit my STOP button before the 10
second timer has expired, I would expect to either see the user agent
string popping up in the text file right away (if r->connection->aborted)
got set, or I would expect Apache to longjmp right out of the PHP code and
I should never see the user agent string.  What is happening is that I
always see the user agent string after exactly 10 seconds regardless of
whether I have hit the stop button earlier or not.

> Oh, I was getting confused with functions/post.c where you ignore SIGPIPE.
> That code looks copied from mod_cgi, and I don't see that you need to
> ignore SIGPIPE in your code since you aren't writing to a CGI.

I thought maybe the Apache code could have set a SIGPIPE handler and I
wanted to make sure I didn't get a SIGPIPE in the middle of reading POST
data.  If there is no handler set, then this code wouldn't do anything.

-Rasmus


Mime
View raw message