Symfony seems to be somewhat resource hungry under some conditions and would leave trail of PHP errors indicating that there is “Too many open files”.
There are several discussions on the topic suggesting that garbage collection mechanism does not close open files in some cases (ex: ConsoleOutput code).
While it is always good to clean up after yourself when working with file handlers in any code, modifying the production code to address this issue may not be quick solution.
Way around it is to increase file limit in Linux
Using ulimit (SSH)
Note: This may not be very reliable method as most systems would not allow it. But if allowed would be easiest method to address the issue
First, check what the current limit is set to
# ulimit -n
Then if value is too low, try to increase it to desired level by calling (ex: increase from 1024 (default) to 4096)
# ulimit -n 4096
To ensure your system allows root level update using method above and not just updates the session values, restart your SSH session then verify new value is set by calling first command again. If changes reverted back to original, go with the next step.
This is more “low level” approach – modify values in limits.conf
# vi /etc/security/limits.conf * soft nofile 1024 * hard nofile 4096
Note: Read the settings format outlined in the file before saving. * may or may not be required.
# vi /etc/sysctl.conf fs.file-max=4096
# sysctl -p
:w – Save edit
:q! – Exit without save
A – Switch into Insert mode
Esc – Exit insert mode