如何诊断这些PHP代码覆盖分段和zend_mm_heap损坏的错误 [英] How to diagnose these PHP-Code-Coverage segmentation and zend_mm_heap corrupted errors
问题描述
我一直很高兴在Ubuntu计算机上进行编码。这是一台拥有大量RAM的强大机器。我当时正在研究4个新类,正在编写和运行单元测试。在某个时候,我注意到,尽管单元测试可以正常完成,但是代码覆盖率却没有。
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.
在出现消息正在生成代码覆盖率报告...等之后。我会收到一条消息,说zend_mm_heap已损坏。我尝试了一些修复程序,包括:在我的php.ini中(将apache2和cli都设置为 output_buffering = On
,并删除对 unset()<的调用) / code>从我的代码中。 (我读过这些,所以可能需要这些修复程序。)
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).
现在,我似乎在zend_mm ...错误和Segmentation Fault(核心转储)错误之间切换, 不管我做什么。我对测试进行注释,直到缩小我认为是导致问题的范围,然后在此处进行一些更改,直到获得干净的运行。然后,我将取消所有测试的注释,只是发现仍然存在故障。
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?
我正在使用PHP_CodeCoverage 1.2.6,PHP 5.3.10-1ubuntu3.5,PHPUnit 3.7.9。
I am using PHP_CodeCoverage 1.2.6, PHP 5.3.10-1ubuntu3.5, PHPUnit 3.7.9.
编辑:
顺便说一句,我找不到任何核心转储文件。从我两个物理磁盘的根目录开始搜索都没有运气。我已经阅读了core上的man条目,包括核心转储不创建文件的可能原因,但我认为这些都不适用。
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.
推荐答案
我最近遇到了同样的问题。 PHP垃圾回收似乎是一个问题。在phpunit运行期间禁用垃圾收集解决了我的问题。
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.
添加:
zend.enable_gc=0
到您的 php.ini
文件或从命令行输入:
to your php.ini
file or from the command line with:
phpunit -d zend.enable_gc=0
这篇关于如何诊断这些PHP代码覆盖分段和zend_mm_heap损坏的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!