Re: PHP (anti) crash policy?
| From: | Manuel Lemos | Date: | Sun, 03 Oct 2004 14:30:08 +0000 |
| Subject: | Re: PHP (anti) crash policy? | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-198541@lists.php.net to get a copy of this message | ||
Hello,
On 10/03/2004 10:18 AM, Olaf Van Der Spek wrote:
That would be breaking the normal behavior of PHP memory handling failures. All memory handling failures are currently not recoverable. I think that making all failed memory allocations recoverable is not viable because more PHP C code that makes memory allocations assumes it only returns if it succeeds. Trying to change that everywhere memory is allocated is and monster job that I doubt that any PHP core developer will agree on doing.That is not the problem. The problem is that zlib does not seem to be able to detect and deal with corrupted streams. That leads to requesting absurd amounts of memory that the PHP memory allocator has no way to distinguish whether it is an intentional memory space request or something case by an abnormal situation. It is not up to PHP memory allocator to guess what is going on. So itIt indeed isn't. However, it should be possible for the zlib code to say to the allocator: "Try to allocate this, if that fails, return an error to me instead of aborting the script".
Gracefully means not crashing with a core dump.handles like an normal memory allocation, gracefully exits like in any other operations that request space above the configured limits.Gracefully, as in aborting/resetting the TCP/HTTP connection?
It is nobody else's fault if you write buggy code. Although it is desirabe to have means to detect program bugs during testing phases, such means may impose performance penalties that may not be reasonable to have in PHP versions running in production. I know there are debugging extensions that can help detecting deep recursion situations. That does not mean that it is good idea to run such extensions on production environments on which you need to have all the performance that you can get.The flaw is in your code as nobody should be writing infinite recursion programs.No, there is A flaw in my code. That doesn't mean it's THE flaw.
I do not think that there is a way for PHP to automatically fix a bug in your code . -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.htmlIf you run a similar program in C it will crash exceeding the acceptable calling stack space. I don't know if you do that in PHP that could be avoided as I don't know if PHP can determine whether the stack space was exceeded. Anyway, the only way to deal with this situation is to let the currentHow can you claim that's the only way if you don't know whether it's avoidable by PHP?