php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #8414 set_time_out() is acting inconsistantly
Submitted: 2000-12-25 05:55 UTC Modified: 2001-05-01 06:43 UTC
From: omakarenko at cyberplat dot ru Assigned:
Status: Closed Package: Performance problem
PHP Version: 4.0.4 OS: linux
Private report: No CVE-ID: None
 [2000-12-25 05:55 UTC] omakarenko at cyberplat dot ru
documentation is not clear enough on what "excecution time"
the max_execution_parameter does limit.

try the following:
<?php
set_time_limit(1);
while(1) sleep(1);
?>

on my machine that runs much more then one second, while:
<?php
set_time_limit(1);
while(1);
?>

stops after 1 second as expected.

That difference is never mentioned in documentaion.

While the usage of PROF timer make sence sometimes the parameter name "max_execution_time" suggests the "real" time limit so that

<?php
set_time_limit(30);
sleep(3600);
?>

should be terminated on timeout after 30 seconds.


oleg

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-04-07 02:10 UTC] danbeck@php.net
I'm re-filing this as a bug report.

It appears that set_time_out() is acting inconsistant.

The following code stops after 5 seconds as you would expect:

set_time_limit(5);
while(1) {
  $i++;
}

While this code continues executing indefinitely:

set_time_limit(5);
while(1) {
  $i++;
  echo "$i\n";
}


 [2001-04-29 22:03 UTC] sniper@php.net
I can't reproduce this with latest CVS. If problem
still persist with PHP 4.0.5 or with latest CVS snapshot
from http://snaps.php.net/ reopen this bug report.

--Jani

 [2001-04-30 05:17 UTC] zeev@php.net
Note that under UNIX, execution time relates to the actual CPU time consumed by PHP, which may be very different (less) than the actual time that passed.  sleep(), for instance, does not consume any CPU time, so it will never trigger the execution timeout.
 [2001-05-01 06:43 UTC] omakarenko at cyberplat dot ru
> Note that under UNIX, execution time relates to the actual
CPU time consumed by PHP, which
> may be very different (less) than the actual time that
passed.  sleep(), for instance,
> does not consume any CPU time, so it will never trigger
the execution timeout.

That's fine. Just put that into documentation cause a lot of
people wrongly consider that "max_execution_time" is
measured in wall clock ticks.



 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 02:01:30 2024 UTC