swiftmailer/swiftmailer — Issue #127: Too many open files (sending 100+ mails within 1 Symfony2 command script)
Author: rschaefer
Created: 2011-10-31 13:21:05+00:00
State: open

Seems the issue presented here:

http://groups.google.com/group/swiftmailer/tree/browse_frm/month/2010-08/1e390267c4dd15cf?rnum=21&_done=%2Fgroup%2Fswiftmailer%2Fbrowse_frm%2Fmonth%2F2010-08%3F

...is back again! And it's a fairly big problem..

I wrote a symfony2 command script that will send a 100+ customized/unique emails to different receipients. ulimit -n is set to 256 and I'm working with symfony2 2.04 (php 5.3.8) which includes one of the most recent swiftmailer versions. The exact error I get is:

[ErrorException] Warning fopen failed to open stream '/path/to/temp/file' - Too many open files in line 301 of blah.php

It seems that swiftmailer does not close it's temporary working-files as long as my script is not finished, exactly like this old bug report from more than a year ago.

This seems to be a big issue, as I'll never be sure that every email will be sent to my receipient list. Besides that, it's not that simple to just change ulimit -n to 10000+ on every hosting facility as a temporary patch (probably need 'root' for that).