Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to diagnose these PHP-Code-Coverage segmentation and zend_mm_heap corrupted errors

I have been happily coding away on my Ubuntu machine. It's a beefy machine with plenty of RAM. I was working on 4 new classes, writing and running unit tests as I go. At some point I noticed that, while the unit tests were completing fine, code coverage was not.

After the message "Generating code coverage report...etc.." I would get a message saying zend_mm_heap corrupted. I tried a few fixes including: setting output_buffering = On in my php.ini (both apache2 and cli), and removing calls to unset() from my code. (I read on SO these fixed might be required).

Now, I seem to alternate between the zend_mm... error, and a Segmentation fault (core dump) error, no matter what I do. I comment out tests until I narrow down the one that I think causes the problem, and make some changes there until I get a clean run. Then I'll uncomment all the test only to find the that fault still occurs.

Any ideas? What tools or method could I use to gather more info?

I am using PHP_CodeCoverage 1.2.6, PHP 5.3.10-1ubuntu3.5, PHPUnit 3.7.9.

EDIT:

As an aside, I can't find any core dump files. Have searched from the root of both my physical disks with no luck. I have read the man entry on core, including the possible reasons for core dumps not creating a file, but I don't think any of those apply.

like image 205
DatsunBing Avatar asked Jan 30 '13 05:01

DatsunBing


1 Answers

I had the same issue recently. It appears to be an issue with PHP garbage collection. Disabling garbage collection during phpunit runs solved the problem to me.

Add:

zend.enable_gc=0 

to your php.ini file or from the command line with:

phpunit -d zend.enable_gc=0
like image 190
Blake Fitzgerald Avatar answered Jan 01 '23 09:01

Blake Fitzgerald