LiipFunctionalTestBundle icon indicating copy to clipboard operation
LiipFunctionalTestBundle copied to clipboard

Kernel not cleaned up in getContainer()

Open kix opened this issue 10 years ago • 4 comments

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?

kix avatar Apr 16 '15 11:04 kix

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.

kix avatar Apr 16 '15 12:04 kix

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()

kix avatar Apr 16 '15 19:04 kix

we do a lot of iffy stuff with the kernel to also get access to the container. there might be something bad happening indeed.

lsmith77 avatar Apr 17 '15 12:04 lsmith77

Looks like symfony/symfony#13448 could be related here, also

kix avatar Jun 11 '15 19:06 kix