httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Slemko <>
Subject Re: Spinning httpds - One Solution
Date Fri, 21 Aug 1998 07:27:31 GMT


First, let me say I don't use php.

So I install it.  I run it in -X.  The second php request for the below
file results in a segv!?!  It dies in malloc()

On Fri, 21 Aug 1998, Rasmus Lerdorf wrote:

> > 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.

I don't see the user-agent string in /tmp/test.txt except in the cases
where I do.

What I mean is that when I first tried to make this work, it was getting
written to somehow.

Later, when I tried again it never wrote to the file and worked just like
it should.

This is on:

Linux lerkim 2.1.107 #2 SMP Mon Jun 29 10:08:13 PDT 1998 i686 unknown

ldd src/httpd => /usr/lib/ (0x4000e000) => /lib/ (0x40014000) => /lib/ (0x4002d000) => /lib/ (0x40030000) => /lib/ (0x4005f000) => /lib/ (0x4006d000)
        /lib/ => /lib/ (0x40000000)

> > 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.

But how do you get a SIGPIPE from reading?

The whole point of mod_cgi doing it is that it is writing to the CGI, and
the CGI could stop reading.

View raw message