Re: PHP (anti) crash policy?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

On 10/03/2004 10:18 AM, Olaf Van Der Spek wrote:
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 it


It 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".

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.


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?

Gracefully means not crashing with a core dump.


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.

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.


If 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 current


How can you claim that's the only way if you don't know whether it's avoidable by PHP?

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.html

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux