#21561 [Bgs]: connection_status() returns 0 even after script times out

From: Date: Fri, 10 Jan 2003 16:49:54 +0000
Subject: #21561 [Bgs]: connection_status() returns 0 even after script times out
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-29690@lists.php.net to get a copy of this message
 ID:               21561
 Updated by:       sniper@php.net
 Reported By:      jc@mega-bucks.co.jp
 Status:           Bogus
 Bug Type:         Unknown/Other Function
 Operating System: Red Hat Linux 7.2
 PHP Version:      4.3.0
 New Comment:

#14542


Previous Comments:
------------------------------------------------------------------------

[2003-01-10 00:26:01] jc@mega-bucks.co.jp

Ok. Can you tell me bug # what this is a duplicate of so I can track
it? I searched but could find a similar bug.

Thanks!

------------------------------------------------------------------------

[2003-01-10 00:19:33] sniper@php.net

Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments
to the existing bug instead.

Thank you for your interest in PHP.

------------------------------------------------------------------------

[2003-01-09 23:33:53] jc@mega-bucks.co.jp

The following code times out, PHP throws an error saying the code has
timed out, *but* calling connection_status() says the code did *not*
time out!

connection_status() returns 0 when it should return 2 ...

My code:

set_time_limit(2);
echo "set execution limit to 2 seconds <BR>";
register_shutdown_function("timed_out");
require_once("db_functions/sql_query.inc");

$sql = "BEGIN;";
$res = sql_query($sql);
$sql = "insert into test(test) values('testing 4');";
$res = sql_query($sql);

//This will cause the script to time out
$i = 0;
while(true) {$i++;}

$sql = "COMMIT;";
$res = sql_query($sql);

function timed_out() {
  $status = connection_status();
  if ($status == 2) {
    echo "the script timed out <BR>";
  }
  else echo "no time out. Connection status is $status <BR>";
}

The OUPUT:

set execution limit to 2 seconds

Fatal error: Maximum execution time of 2 seconds exceeded in
/www/htdocs/jc/shut.php on line 16
no time out. Connection status is 0


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=21561&edit=1



Thread (4 messages)

« previous php.bugs (#29690) next »