Test runner being "Killed" during post-test summary
When running a test suite for a specific large project of 1000+ tests (and at least twice as many assertions), the tests themselves run just fine. However, any tests failing causes a huge memory usage spike during the post-test summary. This spike is so drastic that the phpunit process is killed by Linux's OOM killer as a result:
PHPUnit 3.6.7 by Sebastian Bergmann.
............................................................. 61 / 1044 ( 5%)
............................................................. 122 / 1044 ( 11%)
............................................................. 183 / 1044 ( 17%)
............................................................. 244 / 1044 ( 23%)
............................................................. 305 / 1044 ( 29%)
............................................................. 366 / 1044 ( 35%)
............................................................. 427 / 1044 ( 40%)
............................................................. 488 / 1044 ( 46%)
............................................................. 549 / 1044 ( 52%)
............................................................. 610 / 1044 ( 58%)
............................................................. 671 / 1044 ( 64%)
............................................................. 732 / 1044 ( 70%)
............................................................. 793 / 1044 ( 75%)
............................................................. 854 / 1044 ( 81%)
........................................................F.... 915 / 1044 ( 87%)
............................................................. 976 / 1044 ( 93%)
............................................................. 1037 / 1044 ( 99%)
.......
Time: 01:36, Memory: 113.25Mb
There was 1 failure:
Killed
Any idea what's causing this, or how to work around it?
My first guess would have been "code coverage generation" as I've seen +4k tests with +10k assertions easily consume 3GB of memory and my suggestion would have been to clean up as much as possible in tearDown and see if that helps.
But in your case it seems like you don't generate code coverage reports so I'm mostly guessing here.
It'd say it's ether memory usage or the garbage collection running wild. With 5.2.x it was, for me, common for PHP to segfault once PHPUnit runs got very big but with current versions I didn't run into this.
How does your failing test look like?
If you compair two 2GB strings and PHPUnit is trying to diff them (or something like that) that would explain that.
Regardless of whether or not that is the issue here, maybe we should add limits to diff generation?
EvanK: why did you close issue ? TYIA
Sorry, I didn't mean to close w/o comment. The team lead on our project narrowed it down to one particular test that causes this spike in resource usage even if it's the only test ran. Said test is extending Symfony2's WebTestCase, so I suspect the problem lies there, somewhere...
Is this issue solved? I have the same problem. Please help.
My syslog result,
Jan 31 15:42:06 adem kernel: [ 6260.784323] Out of memory: Kill process 5558 (phpunit) score 852 or sacrifice child Jan 31 15:42:06 adem kernel: [ 6260.784325] Killed process 5558 (phpunit) total-vm:14206088kB, anon-rss:7054836kB, file-rss:1656kB
Same for me here except my tests get 'Killed' in the process of testing. Running the killed test separately passes ok. Increasing memory does not help.
This can happen when you're var_dumping something in code