Re: [PHP-DEV] Interesting sleep() side-effect From: Rasmus Lerdorf (rasmus <email protected>)
Date: 01/27/99

> > In testing Thies' connection abort detection code, completely unrelated to
> > his stuff, I noticed an interesting side-effect of calling sleep() in a
> > PHP script. I have tried this on both Linux and Solaris and get the same
> > results. Could you guys with access to other OS'es try this one?
>
> I just ran your script on CGI PHP 3.0.3 on FreeBSD 2.2.6.
> With sleep commented out, /tmp/done says "i reached 63". With
> sleep uncommented, it says "i reached 70". Obviously, that ain't
> what it should be. So add FreeBSD to your list...

I assume in the first case when it reached 63 without the sleep(1) it did
so in something that seemed like about 5 seconds? I can't quite figure
out the interaction. What you are describing is exactly what I am seeing
on both Linux and Solaris. If the itimer was being reset on each call to
sleep() you would figure it would never time out. But it does kick in
sometime after 70 seconds. It is as if the time spent in the sleep() call
does not count. If you run the script again with the sleep() call left
in, could you time it with a watch and see if it takes exactly 75 seconds
(assuming $i gets to 70)? I think that is what I am seeing here, but I am
not sure.

> (In both cases, the script printed "Maximum execution time of 30
> seconds exceeded" when it died, but that was fixed since 3.0.3,
> right?)

No, that wasn't fixed. It isn't easily fixed actually. I think I will
just remove the number altogether.

-Rasmus

--
PHP Development Mailing List   http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe <email protected>
For help: php-dev-help <email protected>