Return-Path: Delivered-To: new-httpd-archive@hyperreal.org Received: (qmail 2712 invoked by uid 6000); 21 Aug 1998 07:27:35 -0000 Received: (qmail 2705 invoked from network); 21 Aug 1998 07:27:33 -0000 Received: from valis.worldgate.com (marcs@198.161.84.2) by taz.hyperreal.org with SMTP; 21 Aug 1998 07:27:33 -0000 Received: from localhost (marcs@localhost) by valis.worldgate.com (8.9.1/8.9.1) with SMTP id BAA02527 for ; Fri, 21 Aug 1998 01:27:32 -0600 (MDT) Date: Fri, 21 Aug 1998 01:27:31 -0600 (MDT) From: Marc Slemko To: new-httpd@apache.org Subject: Re: Spinning httpds - One Solution In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: new-httpd-owner@apache.org Precedence: bulk Reply-To: new-httpd@apache.org Erm. Well. 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 libgdbm.so.1 => /usr/lib/libgdbm.so.1 (0x4000e000) libm.so.6 => /lib/libm.so.6 (0x40014000) libdl.so.2 => /lib/libdl.so.2 (0x4002d000) libcrypt.so.1 => /lib/libcrypt.so.1 (0x40030000) libresolv.so.2 => /lib/libresolv.so.2 (0x4005f000) libc.so.6 => /lib/libc.so.6 (0x4006d000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (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.