views:

29

answers:

1

In an site I'm currently writing, I'm facing a strange, mind-boggling behaviour: after seconds of 100% CPU usage, the server is responding nothing, only closing the connection. If I limit down the work of this request, it starts working as normal.

XDebug is showing that the bottleneck is not SQL, but rather CPU usage (some function calls 20000 times, many object instances etc.). Another interesting side effect: the request time is considerably longer; Firebug is giving me 600ms for a working request, and 2,2s for a emptily terminating request with only double as much work.

I'm pretty sure that it's not the execution time limit (it's set to indefinite), nor the memory limit (as no PHP Error comes back).

For the record, I'm using: Apache 2.2.12 mpm-prefork/Ubuntu, PHP 5.2.10
Similar behaviour has been observed on Windows.

Any hints to explain this behaviour? Is maybe Apache killing threads he supposes to be in an indefinite loop? Or is there some log file I could look at?

A: 

Apache's error.log is saying

zend_mm_heap corrupted

which is leading to a PHP Bug page with an workaround. It seems to appear under heavy load and may be related to a zend_extension.

giraff
Does setting USE_ZEND_ALLOC=0 actually fix the problem for you though?
Mark Baker
Yes it does, though Apache now saturates my memory every 2 hours ... suboptimal.
giraff