symfony: symfony/console 5.4.12 make db Too many connection errors
Symfony version(s) affected
5.4.12
Description
I upgrade symfony/console to last version (5.4.12) and lots of my functionnal tests doesn’t work anymore because of error like:
1) App\Tests\Infra\Review\ReviewBoosterSenderTest::****Send with data set "sms" (1, 2)
Doctrine\DBAL\Exception\DriverException: An exception occurred in the driver: SQLSTATE[08004] [1040] Too many connections
/root/project/vendor/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php:117
/root/project/vendor/doctrine/dbal/src/Connection.php:1818
/root/project/vendor/doctrine/dbal/src/Connection.php:1767
/root/project/vendor/doctrine/dbal/src/Connection.php:328
/root/project/vendor/doctrine/dbal/src/Connection.php:1529
/root/project/vendor/doctrine/dbal/src/Connection.php:1010
/root/project/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:750
/root/project/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:768
/root/project/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:521
/root/project/var/cache/****/ContainerRdlthlA/EntityManager_9a5be93.php:95
/root/project/vendor/doctrine/orm/lib/Doctrine/ORM/EntityRepository.php:199
/root/project/src/Infra/Shop/Repository/ShopRepository.php:42
/root/project/src/Infra/Review/ReviewBoosterSender.php:47
/root/project/****s/Infra/Review/ReviewBoosterSenderTest.php:27
/root/project/vendor/phpunit/phpunit/src/Framework/TestResult.php:726
/root/project/vendor/phpunit/phpunit/src/Framework/TestSuite.php:672
/root/project/vendor/phpunit/phpunit/src/Framework/TestSuite.php:672
/root/project/vendor/phpunit/phpunit/src/Framework/TestSuite.php:672
/root/project/vendor/phpunit/phpunit/src/Framework/TestSuite.php:672
/root/project/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:673
Caused by
Doctrine\DBAL\Driver\PDO\Exception: SQLSTATE[08004] [1040] Too many connections
/root/project/vendor/doctrine/dbal/src/Driver/PDO/Exception.php:28
/root/project/vendor/doctrine/dbal/src/Driver/PDO/MySQL/Driver.php:34
/root/project/vendor/doctrine/dbal/src/Connection.php:326
/root/project/vendor/doctrine/dbal/src/Connection.php:1529
/root/project/vendor/doctrine/dbal/src/Connection.php:1010
/root/project/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:750
/root/project/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:768
/root/project/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:521
/root/project/var/cache/****/ContainerRdlthlA/EntityManager_9a5be93.php:95
/root/project/vendor/doctrine/orm/lib/Doctrine/ORM/EntityRepository.php:199
/root/project/src/Infra/Shop/Repository/ShopRepository.php:42
/root/project/src/Infra/Review/ReviewBoosterSender.php:47
/root/project/****s/Infra/Review/ReviewBoosterSenderTest.php:27
/root/project/vendor/phpunit/phpunit/src/Framework/TestResult.php:726
/root/project/vendor/phpunit/phpunit/src/Framework/TestSuite.php:672
/root/project/vendor/phpunit/phpunit/src/Framework/TestSuite.php:672
/root/project/vendor/phpunit/phpunit/src/Framework/TestSuite.php:672
/root/project/vendor/phpunit/phpunit/src/Framework/TestSuite.php:672
/root/project/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:673
Caused by
PDOException: SQLSTATE[08004] [1040] Too many connections
/root/project/vendor/doctrine/dbal/src/Driver/PDO/MySQL/Driver.php:28
/root/project/vendor/doctrine/dbal/src/Connection.php:326
/root/project/vendor/doctrine/dbal/src/Connection.php:1529
/root/project/vendor/doctrine/dbal/src/Connection.php:1010
/root/project/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:750
/root/project/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:768
/root/project/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:521
/root/project/var/cache/****/ContainerRdlthlA/EntityManager_9a5be93.php:95
/root/project/vendor/doctrine/orm/lib/Doctrine/ORM/EntityRepository.php:199
/root/project/src/Infra/Shop/Repository/ShopRepository.php:42
/root/project/src/Infra/Review/ReviewBoosterSender.php:47
/root/project/****s/Infra/Review/ReviewBoosterSenderTest.php:27
/root/project/vendor/phpunit/phpunit/src/Framework/TestResult.php:726
/root/project/vendor/phpunit/phpunit/src/Framework/TestSuite.php:672
/root/project/vendor/phpunit/phpunit/src/Framework/TestSuite.php:672
/root/project/vendor/phpunit/phpunit/src/Framework/TestSuite.php:672
/root/project/vendor/phpunit/phpunit/src/Framework/TestSuite.php:672
/root/project/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:673
Really wird problem but I don’t have it with symfony/console 5.4.11. Is it possible there is a problem in https://github.com/symfony/console/compare/v5.4.11...v5.4.12 ?
How to reproduce
Run lot of functionnals tests on a project with symfony/console 5.4.12 installed
Possible Solution
No response
Additional Context
It is not happened when only one tests is run.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (3 by maintainers)
@kfrohwein To be clear from your comments, both
v5.4.10andv5.4.11, of the Console Component, do not exhibit the defect, yet you DO definitively and repeatedly experience the defect inv5.4.12– full stop? Second question, have you tried any patches beyondv5.4.12(specifically,v5.4.[13-24])? Let us know! Super useful!@Kleinast You experienced the defect at patch
v5.4.12? Specifically and unequivocally that patch? If yes, that corroborates @kfrohwein report “to the tea”. I know a project that is runningv5.4.24and is experiencing the “Too many connections” error. So potentially three affected people/orgs here that took time to document here… one can only imagine how many more are out there struggling with this seemingly phantomish edge/corner case!Genesis:
Breaking Change (Per Anecdotal Reports / Not Confirmed):
Authors are @xabbuh and @GwendolenLynch. Change was committed by @nicolas-grekas. Any keen insight(s), ponderings, brain dumps, from anyone in that trio? 🥺
@kfrohwein @Kleinast It was emphasized to you by @xabbuh above, and I’ll re-emphasis what I believe the sentiment in the communication to be:
This issue is will not resolved as-is. We need more contextual information – even just a little, to bring us closer to solving this! Anything is better than nothing and super appreciated! If you don’t have time, etc., to create a failing use case, as was requested above by @xabbuh, could you maybe add some “low hanging fruit” (high value, low effort, info) into this issue? Examples:
bin/console debug:config ...)?neofetch --stdoutwould be great to see).php -m) on your system?php -iwould be great, too. To boot,phpinfo()from the web too 🏆bin/console messenger:consume“for a long time”, both as to gather more anecdotal information as well as an easy path to reproducing the issue.9a. How are you running your worker/consumer process(es)? More specifically, what command options and/or arguments are you using (time limit and/or max memory and/or etc., …)? If you have the exact command, that’d be epic! Are you leveraging a process manager (i.e., supervisord), or is execution occurring without that added layer – for example, as a Docker Container (Service)? Please let us know! … And if the former, what’s your manager (i.e. supervisor) config? If the latter, may we kindly see your
docker compose configconstruct for your worker definition(s)? Something as simple asdocker compose config | yqwould be grand!Thanks ya’ll! 🥇
P.S. @weaverryan big fan of SymfonyCasts bro, have you heard (whispers?) of this issue at all???