Kernel not cleaned up in getContainer()
Running several WebTestCase descendants leads to UnexpectedValueException: RecursiveDirectoryIterator::__construct(...): failed to open dir: Too many open files. Perhaps this is due to kernel not being reused correctly?
Here's the full exception trace, just in case:
UnexpectedValueException: RecursiveDirectoryIterator::__construct(../vendor/symfony/symfony/src/Symfony/Component/Form/Resources/translations): failed to open dir: Too many open files
.../vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/RecursiveDirectoryIterator.php:49
.../vendor/symfony/symfony/src/Symfony/Component/Finder/Adapter/PhpAdapter.php:35
.../vendor/symfony/symfony/src/Symfony/Component/Finder/Finder.php:795
.../vendor/symfony/symfony/src/Symfony/Component/Finder/Finder.php:707
.../vendor/jms/di-extra-bundle/JMS/DiExtraBundle/Finder/PatternFinder.php:185
.../vendor/jms/di-extra-bundle/JMS/DiExtraBundle/Finder/PatternFinder.php:72
.../vendor/jms/di-extra-bundle/JMS/DiExtraBundle/Config/FastDirectoriesResource.php:76
.../vendor/jms/di-extra-bundle/JMS/DiExtraBundle/Config/FastDirectoriesResource.php:59
.../app/bootstrap.php.cache:2835
.../app/bootstrap.php.cache:2485
.../app/bootstrap.php.cache:2266
.../vendor/liip/functional-test-bundle/Test/WebTestCase.php:153
.../vendor/liip/functional-test-bundle/Test/WebTestCase.php:256
.../path/to/my/TestCase.php:19
/Users/kix/.composer/vendor/phpunit/phpunit/src/TextUI/Command.php:179
/Users/kix/.composer/vendor/phpunit/phpunit/src/TextUI/Command.php:132
Looks like JMSDiExtraBundle could also be involved.
I've switched my tests to Symfony's built-in WebTestCase, and the results are quite interesting:
Liip WebTestCase as base:
Time: 1.24 minutes, Memory: 400.25Mb
Symfony's built-in WebTestCase:
Time: 36.27 seconds, Memory: 90.25Mb
I'm loading some (not much, really) fixtures in my setUps and do a lot of calls to $this->getContainer()
we do a lot of iffy stuff with the kernel to also get access to the container. there might be something bad happening indeed.
Looks like symfony/symfony#13448 could be related here, also