in reply to Re^2: How to debug "Too Many Open Files" Error
in thread How to debug "Too Many Open Files" Error

The full error provides us some extremely useful context. Something cannot run the command /var/www/vhosts/cfhs69.com/cgi-bin/alumni001A.pl. Glancing at your website I'm going to bet that that command is what is run by Apache to serve the page http://www.cfhs69.com/cgi-bin/alumni001A.pl. Which tells me that the error message is almost certainly coming from Apache, and not your code.

Googling around I am willing to bet that it has to do with the problem explained in http://httpd.apache.org/docs/1.3/misc/FAQ.html#fdlim. Namely that your hosting provider is trying to run too many virtual hosts out of Apache, with the result that sometimes you get an Apache process that has opened up too many files, connections, etc and can't open another. (They may be using Apache 2, but the same issue still exists because it is an operating system limit, not an Apache limit.)

In which case the possible solutions are that they can raise the operating system limit as is documented there, they can run fewer virtual hosts per server, or you can find a more competent hosting provider.

PS: Please call the language Perl, not PERL. See the FAQ for verification. Calling it by the wrong name grates on people who are competent with the language. So unless you actively want to irritate people here, you really should call it by the right name.

  • Comment on Re^3: How to debug "Too Many Open Files" Error

Replies are listed 'Best First'.
Re^4: How to debug "Too Many Open Files" Error
by kubrat (Scribe) on Sep 17, 2008 at 15:29 UTC

    Just to add to the possible solutions bit. Another popular solution is to configure Apache to write to its access and error logs via pipes.

      I assume this is something I would tell the host, right? Help me understand the suggestion: Is it that Apache is typically configured to write the access and error logs as open files? And if it is reconfigured as you suggest, then these operations would not count as open files? If this be true, what is the downside? I.E., why did he not configure it that way in the first place? I'm just trying to get smart so I can have an intelligent conversation with the host. Thanks Tony
Re^4: How to debug "Too Many Open Files" Error
by tonyb48 (Novice) on Sep 17, 2008 at 19:52 UTC
    Thanks very much for this answer. It will help me have a more constructive dialog with my hosting service. They offered to migrate my sites (I have a second similar site for a different alumni body, which is having the same problems) to a different server with less traffic. I will refer them to the article you referenced. I will ask them to run the commands:
    echo 8192 > /proc/sys/fs/file-maxecho && 32768 > /proc/sys/fs/inode-ma +x
    ulimit -a
    ulimit -n
    ulimit -H
    I would also like to try inserting
    warn `ls -l /proc/$$/fd/` . ' ';
    into the 3 most popular modules in the script. Finally, thanks for the suggestions on not capitalizing Perl. I had no idea. The last thing I want to do is offend the very people from whom I need help.