Re: *crash* on try to find out how many nestinglevelsare allowed
| From: | Andi Gutmans | Date: | Sun, 09 Jul 2000 17:01:32 +0000 |
| Subject: | Re: *crash* on try to find out how many nestinglevelsare allowed | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-23936@lists.php.net to get a copy of this message | ||
At 12:15 09/07/00 -0400, Shane Caraveo wrote:
<cut>
It can only be fixed, as far as I know, by adding code which will limited the amount of recursive function calls. This will not only slow down PHP but it will also pose the question of where the limit is. Not all systems have the same stack size or each up the stack at the same rate. In my opinion, we are better off leaving it the way it is for now although for multi-threaded servers we might want to enable the *slow* approach. Anyway, maybe the best is not to write infinite recursion? Andi I agree that writing infinite recursion is not a good thing and should not be done. I disagree that it should crash php. Sometimes bugs (in scripts, certainly not in php itself ;-) just happen, possibly even infinite recursion. On my server, there are several people who write scripts, not all being real programmers, I can see stuff happening that could lead to a crash, which could take down all the sites on the server. If it's possible to prevent such a crash, that is an option I would want.Luckily at least with Apache crashing the web server isn't a big deal. Anyway, as I said things aren't always that simple
Do you have any remote idea of how much it would slow down php? You and Zeev added a lot of performance to php, I would rather sacrifice some of that new speed for stability. I may be wrong as I know next to nothing about parsers, but I would think it should be possible to check the remaining stack size and throw a stack overflow error (if that happens),I disagree. I don't want to slow down PHP significantly for this purpose. Checking the current stack size is a system call and it is something you would have to add logic in every function call to check it. To make a long story short, I'm open to ideas, but I don't want to slow down PHP significantly for 100% of the people when 0.00000001% have a problem with their Apache server crashing because they write infinite recursion. The Apache parent process will respawn a new one. Andi --- Andi Gutmans <andi@zend.com> http://www.zend.com/rather than crashing. Doing it this way would also do away with anyneed to count the number of recursions (and have some limit on that).