Closed
Description
Symfony version(s) affected: 4.4.2
Description
When we update to 4.4, my tests go from this:
Time: 7.7 minutes, Memory: 295.00 MB
OK (1878 tests, 8872 assertions)
To this:
Time: 30.83 minutes, Memory: 9.03 GB
There was 1 error:
1) Hyra\Tests\Integration\Tasks\Command\WorkerCommandTest::testExecute
proc_open(): fork failed - Cannot allocate memory
vendor/symfony/console/Terminal.php:157
vendor/symfony/console/Terminal.php:143
vendor/symfony/console/Terminal.php:109
vendor/symfony/console/Terminal.php:92
vendor/symfony/console/Terminal.php:33
vendor/symfony/console/Style/SymfonyStyle.php:51
src/Tasks/Command/WorkerCommand.php:59
vendor/symfony/console/Command/Command.php:255
vendor/symfony/console/Tester/CommandTester.php:76
tests/Integration/Tasks/Command/WorkerCommandTest.php:59
--
There was 1 failure:
1) Hyra\Tests\Functional\Negotiate\Download\DealContractFileUrlTest::testTenantsDownloadsContractWithCoverSheetAttachedInReview
Failed asserting that 500 is identical to 200.
tests/Functional/Negotiate/Download/DealContractFileUrlTest.php:118
ERRORS!
Tests: 1876, Assertions: 8852, Errors: 1, Failures: 1.
At first, we thought that #34567 would fix it, but that was released a while back and it did not make a difference. Another possibly related issue would be #25964.
I've been unable to track down the actual issue, and can't seem to break down the problem into a reproducer on a blank Symfony installation. However, here is everything I've been able to figure out:
- Only seems to be an issue for tests extending WebTestCase and booting the kernel
- Running a single WebTestCase test uses marginally higher memory, but not by much
- Running multiple WebTestCase tests causes the memory usage to grow much faster
- Examples:
- 1 test uses 40.5MB on 4.3 but 42.5MB on 4.4
- 8 tests uses 48.5MB on 4.3 but 86.5MB on 4.4
- 19 tests uses 54.5MB on 4.3 but 158.5 MB on 4.4
- Blackfire profile running a test subset on 4.3
- Blackfire profile running a test subset on 4.4
- Blackfire comparison
How to reproduce
We can't get a bug reproducer working, however these are the steps I've taken:
composer update symfony/*
- Run tests like normal
php vendor/bin/phpunit
Additional context
- To rule out problems with other package upgrades we locked Symfony to 4.3 using
extra.symfony.require: "4.3.*"
in composer.json then ran a composer update. Then withextra.symfony.require: "^4.2.0"
rancomposer update symfony/*
- Initially we was using symfony/phpunit-bridge, but ruled out an issue with that by uninstalling it and using phpunit/phpunit directly
- We're using the LiipFunctionalTestBundle and the LiipTestFixturesBundle and loading fixtures in the WebTestCase
- We are using the TestContainer to access services in tests
- The test subset I'm running does not use the PhpUnit
setUp
functions