单元测试:“打开的文件太多”和“太多连接”升级到symfony之后的错误2.5 [英] Unit testing: "Too many open files" and "Too many connections" errors after upgrade to symfony 2.5
问题描述
我有一个Symfony2项目,有超过200个功能测试。
与Symfony 2.3和2.4一切工作,但升级到2.5后,我开始收到一个错误(我使用Mac OS X):
无法打开流程:打开文件太多
我已经google了一下,并更改了max_files参数在系统配置中。
之后,我开始收到另一个错误:
未捕获的异常'PDOException'与消息'SQLSTATE [08004] [1040]连接太多
确定,我更改了MySQL中的max-connections参数,但升级后看起来有些错误。像一些系统资源正在持有。
在降级到2.4之后,一切都会变得正常。
也许现在我必须关闭一些资源或连接手动在某处?或者问题在别的地方?
UPD:我发现一个问题同样的问题:单元测试期间连接过多
只需在运行单元测试之前执行ulimit -n 10000。
另一个解决方案(我认为最好的解决方案)是使用内存数据库。您的测试运行速度会更快。
It looks like some system resources are holding in Symfony 2.5 while tests are running.
I have a Symfony2 project with more than 200 functional tests. With Symfony 2.3 and 2.4 everything worked, but after upgrade to 2.5 I began receiving an error (I use Mac OS X):
failed to open stream: Too many open files
I googled a little and changed max_files parameter in system config.
After that I began receiving another error:
Uncaught exception 'PDOException' with message 'SQLSTATE[08004] [1040] Too many connections'
OK, I changed the max-connections parameter in MySQL, but it looks like something is wrong after upgrade. Like some system resources are holding.
After downgrade back to 2.4 everything becomes OK again.
Maybe now I have to close some resources or connections manually somewhere? Or the problem is somewhere else?
UPD: I have found one more question with same problem: Too many connection during unit testing
Just execute "ulimit -n 10000" before running unit tests. Another solution (I think the best solution) is to use "in memory" database. Your tests will run faster.
这篇关于单元测试:“打开的文件太多”和“太多连接”升级到symfony之后的错误2.5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!