B
Bennett Haselton
I have a script that sends mail using the Mail::Bulkmail class from:
http://search.cpan.org/dist/Mail-Bulkmail/
I'm already using version 3.12 which according to that page is the
most recent available.
Even if you don't know the details of how Mail::Bulkmail works, I
suspect someone familiar with Perl or Linux internals may have a
suggestion on how to work around this problem.
After Mail::Bulkmail has been invoked, I think, a few hundred times,
the script crashes with the error message:
Could not initilize method (GOOD) to value (/var/www/good.txt) :
Could not open file /var/www/good.txt : Too many open files at ./send-
pending-messages-using-bulkmail.pl line 154.
Now the /var/www/good.txt file is specified in my bulkmail-config.txt
file as the file to write "good" addresses to. While the script is
running, the lsof command shows me these instances of handles on the
"good" file being already open:
peacefire:/var/www/html/circumventor# lsof -u root | grep good
send-pend 23961 root 6w REG 0,125 20427325
302910600 /var/www/good.txt
send-pend 23961 root 10w REG 0,125 20427325
302910600 /var/www/good.txt
send-pend 23961 root 13w REG 0,125 20427325
302910600 /var/www/good.txt
[...]
where the number of lines is the number of times that
Mail::Bulkmail::bulkmail() has been called. In other words, it looks
like each instance bulkmail() is opening a new file handle on good.txt
and not closing it properly.
After the script crashes, all the handles get closed automatically, so
I just have to restart the script and it's back up and running. But
can anyone guess a workaround that would allow the script to run
longer?
In the bulkmail config file I have these lines:
#log our errors
ERRFILE = /var/www/error.txt
BAD = /var/www/bad.txt
GOOD = /var/www/good.txt
banned = /var/www/banned.txt
So if I just commented the lines out completely, that might solve the
problem as nothing is logged any more, but I'd like to do some logging
so I'm hoping for a cleaner solution.
Bennett
http://search.cpan.org/dist/Mail-Bulkmail/
I'm already using version 3.12 which according to that page is the
most recent available.
Even if you don't know the details of how Mail::Bulkmail works, I
suspect someone familiar with Perl or Linux internals may have a
suggestion on how to work around this problem.
After Mail::Bulkmail has been invoked, I think, a few hundred times,
the script crashes with the error message:
Could not initilize method (GOOD) to value (/var/www/good.txt) :
Could not open file /var/www/good.txt : Too many open files at ./send-
pending-messages-using-bulkmail.pl line 154.
Now the /var/www/good.txt file is specified in my bulkmail-config.txt
file as the file to write "good" addresses to. While the script is
running, the lsof command shows me these instances of handles on the
"good" file being already open:
peacefire:/var/www/html/circumventor# lsof -u root | grep good
send-pend 23961 root 6w REG 0,125 20427325
302910600 /var/www/good.txt
send-pend 23961 root 10w REG 0,125 20427325
302910600 /var/www/good.txt
send-pend 23961 root 13w REG 0,125 20427325
302910600 /var/www/good.txt
[...]
where the number of lines is the number of times that
Mail::Bulkmail::bulkmail() has been called. In other words, it looks
like each instance bulkmail() is opening a new file handle on good.txt
and not closing it properly.
After the script crashes, all the handles get closed automatically, so
I just have to restart the script and it's back up and running. But
can anyone guess a workaround that would allow the script to run
longer?
In the bulkmail config file I have these lines:
#log our errors
ERRFILE = /var/www/error.txt
BAD = /var/www/bad.txt
GOOD = /var/www/good.txt
banned = /var/www/banned.txt
So if I just commented the lines out completely, that might solve the
problem as nothing is logged any more, but I'd like to do some logging
so I'm hoping for a cleaner solution.
Bennett