php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51701 "Maximum execution time exceeded" error with round() API on octeon platform
Submitted: 2010-04-30 07:02 UTC Modified: 2018-09-02 09:34 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: k dot nagakiran at gmail dot com Assigned: cmb (profile)
Status: No Feedback Package: Math related
PHP Version: 5.3.2 OS: Octeon
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: k dot nagakiran at gmail dot com
New email:
PHP Version: OS:

 

 [2010-04-30 07:02 UTC] k dot nagakiran at gmail dot com
Description:
------------
I am facing issues with round() API of PHP 5.3.2 compiled for octeon platform.

The following one line script throws the following error:

"Maximum execution time of 30 seconds exceeded in <fileName>"

<?php
echo round(12);
?>

With gdb, I noticed that its doing an infinite loop inside 
"static Bigint * mult(Bigint *a, Bigint *b)"  in Zend/zend_strtod.c

It works fine with PHP 5.2.3 compiled for octeon platform.
I don't see any difference in function definition between these 2 releases.

Is it a known issue or any patch available?
Please let me know if I need to provide more information.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-04-30 08:55 UTC] k dot nagakiran at gmail dot com
Stack Trace:
(gdb) bt
#0  mult (a=0xb32000, b=0xb33000) at src/dist/php/Zend/zend_strtod.c:674
#1  0x006c9604 in pow5mult (b=0xb32000, k=<value optimized out>) at src/dist/php/Zend/zend_strtod.c:803
#2  0x006cbf80 in zend_dtoa (_d=<value optimized out>, mode=2, ndigits=14, decpt=0x3ffe9d80, sign=0x3ffe9d84, rve=0x0) at src/dist/php/Zend/zend_strtod.c:1838
#3  0x005cd3c4 in php_gcvt (value=12, ndigit=14, dec_point=46 '.', exponent=0 '\0', buf=0x3ffe9df1 "") at src/dist/php/main/snprintf.c:142
#4  0x005ce67c in vspprintf (pbuf=0x3ffea0e8, max_len=0, format=<value optimized out>, ap=<value optimized out>) at src/dist/php/main/spprintf.c:669
#5  0x00620db8 in zend_spprintf (message=0x3ffea0e8, max_len=0, format=0x2 <Address 0x2 out of bounds>) at src/dist/php/Zend/zend_exceptions.c:529
#6  0x006bc270 in zend_locale_sprintf_double (op=0x3ffea0e8) at src/dist/php/Zend/zend_operators.c:2047
#7  0x005f8dbc in zend_make_printable_zval (expr=0x9aec40, expr_copy=0x3ffea0e8, use_copy=0x3ffea0f8) at src/dist/php/Zend/zend.c:276
#8  0x005f8e8c in zend_print_zval_ex (write_func=0x5bb56c <php_body_write_wrapper>, expr=0x3ffea0e8, indent=<value optimized out>) at src/dist/php/Zend/zend.c:300
#9  0x005f95a0 in zend_print_zval (expr=0x0, indent=2) at src/dist/php/Zend/zend.c:291
#10 0x006cce04 in zend_print_variable (var=0x3ffea0e8) at src/dist/php/Zend/zend_variables.c:150
#11 0x0063d2b0 in ZEND_ECHO_SPEC_VAR_HANDLER (execute_data=0xaf1020) at src/dist/php/Zend/zend_vm_execute.h:7819
#12 0x00625ea4 in execute (op_array=<value optimized out>) at src/dist/php/Zend/zend_vm_execute.h:104
#13 0x005f7328 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at src/dist/php/Zend/zend.c:1194
#14 0x005bafbc in php_execute_script (primary_file=0x3ffeb8b8) at src/dist/php/main/main.c:2260
#15 0x006cffa4 in main (argc=0, argv=0x0) at src/dist/php/sapi/cgi/cgi_main.c:2102
(gdb) finish
Run till exit from #0  mult (a=0xb32000, b=0xb33000) at src/dist/php/Zend/zend_strtod.c:674
0x006c9604 in pow5mult (b=0xb32000, k=<value optimized out>) at src/dist/php/Zend/zend_strtod.c:803
803     in src/dist/php/Zend/zend_strtod.c
Value returned is $22 = (Bigint *) 0xb34000
(gdb) finish
Run till exit from #0  0x006c9604 in pow5mult (b=0xb32000, k=<value optimized out>) at src/dist/php/Zend/zend_strtod.c:803
X-Powered-By: PHP/5.3.2
Content-type: text/html

<br />
<b>Fatal error</b>:  Maximum execution time of 30 seconds exceeded in <b>/cf/var/jail/jail-srxsme/html/testPHP.php</b> on line <b>13</b><br />

Program exited with code 0377.
 [2010-05-20 14:31 UTC] magnolitao at gmail dot com
I had a problem like this with php 5.3.2. but on freebsd 7.2...

Not a problem of max_execution_time but with the round() function, 

<?php
echo round((5.5/100),3);
// gives : 0.0550000000000000002775557561563 <== I specified and expected 3 floats, and no 30 !
?>
I have tested it on different PHP versions and OS, and others worked fine.
<?php
echo round((5.5/100),3);
// gives : 0.055
?>

Finally, the error was in my php.ini, "precision" was setted to 30.
I change it to 14 , as usually.
Now, it works fine.
It was my responsability.... but this comportement of round() is very surprising and I suppose this could help to understand a problem of max_execution of time if your "precision" is very large.

I tested to raise progressively the "precision" to 100000 and even if I cannot obtain an error like "max_execution_time exceeded", pages were more and more long to charge until I obtain this error : "Balloc() allocation exceeds list boundary".
Before, the max of floats I obtained is 57 : 0.055000000000000000277555756156289135105907917022705078125.

I don't know if we could talk about a bug for this comportment of PHP, but it seems very important to let the directive "precision" to 14...
 [2018-08-14 15:03 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2018-08-14 15:03 UTC] cmb@php.net
Is that still an issue with actively supported PHP versions[1]?

[1] <http://php.net/supported-versions.php>
 [2018-09-02 09:34 UTC] cmb@php.net
-Status: Feedback +Status: No Feedback
 [2018-09-02 09:34 UTC] cmb@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 06:01:28 2024 UTC