php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39448 Maximum execution time exceeded even if is unlimited
Submitted: 2006-11-09 12:39 UTC Modified: 2006-11-17 01:00 UTC
Votes:7
Avg. Score:4.0 ± 0.8
Reproduced:6 of 6 (100.0%)
Same Version:3 (50.0%)
Same OS:1 (16.7%)
From: jschwabik at koop dot cz Assigned:
Status: No Feedback Package: Performance problem
PHP Version: 5.2.0 OS: CentOS release 4.3
Private report: No CVE-ID: None
 [2006-11-09 12:39 UTC] jschwabik at koop dot cz
Description:
------------
I've got script running from linux shell and sometimes it crashes with "Maximum execution time of 30 seconds exceeded in some line" error in the script. 

The command on which it crashes is unpredictable. The script is runnig sometimes 10 minutes, sometimes 30 minutes and crashes on different lines. (It never runs 30 seconds).  

I am running it from command line (CLI) (max_execution_time should be 0) an I set it with set_time_limit(0) to 0.

I've tried two servers 4 php versions (4.4.2, 4.4.4,5.1.6,5.2.0)

In my php.ini is max_execution_time set to 0.

Sometimes it ends on ifx_fetch_row().
Sometimes it ends on mktime().

My configure
'./configure' '--with-config-file-path=/etc/php.ini' '--with-apache=../apache_1.3.37/' '--with-informix=/opt/informix' '--with-mysql=/usr/local/mysql/' '--enable-ftp' '--with-gd' '--enable-gd-native-ttf' '--enable-gd-imgstrttf' '--with-zlib' '--with-jpeg-dir=/usr/' '--with-freetype-dir=/usr' '--with-dom=./ext' '--with-ldap' '--with-mssql=/usr/local/' '--enable-dbase' '--with-iconv=/usr/local' 


PHP Core Info
.
.
.
max_execution_time => 0 => 30
max_input_time => -1 => 60
open_basedir => no value => no value
output_buffering => 0 => no value
output_handler => no value => no value
post_max_size => 8M => 8M
precision => 12 => 12
safe_mode => Off => Off
.
.
.

Reproduce code:
---------------
<? 
set_time_limit(0);

//connection to MYsql database
//connection to Informix database

//running Informix query (10 queries)


//doing some transformations and inserting into MYsql database (multiple insert every 100 rows)

echo "End";
 

?>




Expected result:
----------------
"End" is echoed or some meaningful error message. 

Actual result:
--------------
Fatal error:Maximum execution time of 30 seconds exceeded in ...

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-09 17:10 UTC] tony2001@php.net
Not reproducible.
 [2006-11-10 19:29 UTC] christoph at ziegenberg dot de
Perhaps this has to do with the problem in Bug #39361, where ini settings which are valid for a directory only are still active when leaving the directory (although ini_get() returns the correct value).

I tested some settings and they worked, so I though this problem is a mbstring problem - but it possibly occurs also with other ini settings...
 [2006-11-17 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2007-03-12 19:26 UTC] quentinjs at gmail dot dom
I'm using IIS, MySQL, and PHP 5.1.1.  This problem starting happening randomly within the code, and there doesn't seem to be a reason for it other then it seems to be related to MySQL calls...  but I haven't taken the time yet to test that theory.  Its also is random which makes it VERY hard to create a reproducable version.

I'll be upgrading PHP and MySQL tonight and will then spend some time building a test case to reproduce this problem as its becoming more frequent as of late.
 [2010-09-07 17:54 UTC] jwagner at computing dot dcu dot ie
Regarding the unpredictable moment when execution stops, please note that 
max_execution_time only applies to time spent by crunching php code, i.e. the 
30 seconds stop counting down when you run a shell command, query your mysql 
database etc. Therefore, the 30 seconds may be over after 10 minutes or 5 
hours. It all depends on what your php code is doing. Theoretically, if php 
automatically parallelised code on multiple cores, the 30 seconds could also be 
over even quicker than 30 seconds real time.

Regarding the set_time_limit(0), you need to be in soft mode in order to be 
able to raise your limits.

JJ
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 19:01:30 2024 UTC