PHP 4.0 Bug #9136 Updated: simple script with infinite function calls causes seg fault
| From: | waldschrott@php.net | Date: | Tue, 06 Feb 2001 22:41:12 +0000 |
| Subject: | PHP 4.0 Bug #9136 Updated: simple script with infinite function calls causes seg fault | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-45887@lists.php.net to get a copy of this message | ||
ID: 9136
Updated by: waldschrott
Reported By: nathan@synop.com
Old-Status: Closed
Status: Feedback
Old-Bug Type: Reproduceable crash
Bug Type: Feature/Change Request
Assigned To: waldschrott
Comments:
maybe we should move this to feature request for safe mode?
it would be fine to give the server owner the possibility to
autokill scripts which would kill the server in a few
microseconds, shouldn't it be implementable without loosing
performance, check the level the stack is filled up against
a values in php.ini maybe...
Previous Comments:
---------------------------------------------------------------------------
[2001-02-06 17:31:02] waldschrott@php.net
and guess this "bug" was present in any version before, what
do you expect to happen here? you will never leave these
function calls (as you know I guess), as far as your stack
is full it is full
remember php has to remember each and every function call it
did...
a()
b()
a()
b()
....
if you really need exactly this construct, I would suggest
you to use a static variable to count the total function
calls and find the critical values a specific system
segfaults (with your original code), then you stick a
for(;;) around it and implement a check (eg. in a()) against
the static variable to leave the recursion if a value with
enough distance to the critical value is reached, then you
should be able to begin the recursion again
any recursion can be displayed as a loop, do not use
recursion if you want to recurse infinitely
---------------------------------------------------------------------------
[2001-02-06 17:22:36] derick@php.net
PHP doesn't handle infinite recursion, and as earlier was discussed on the php-dev list, it
wont be implemented to guard for this, because of the high performance impact.
---------------------------------------------------------------------------
[2001-02-06 17:18:03] nathan@synop.com
-------------------
<%
function a () {
b();
}
function b () {
a();
}
a();
%>
<h1>done</h1>
---------------------
The simple script above causes a seg fault. If you need more info on configuration etc please mail
me. We made this simple example from a more compilcated instance. This bug was also present in
4.0.3pl1, we upgraded to try and stop the seg fault...
thanks!
---------------------------------------------------------------------------
ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=9136&edit=2