Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: How to debug "Too Many Open Files" Error

by betterworld (Curate)
on Sep 16, 2008 at 19:21 UTC ( [id://711782]=note: print w/replies, xml ) Need Help??


in reply to How to debug "Too Many Open Files" Error

It might help to know what technologies you use. Although most hosting providers only provide CGI as a means to run Perl scripts, this error message sounds more like it could happen in a long-running service like mod_perl or FastCGI.

Anyway, if the server runs Linux, the result of `ls -l /proc/$$/fd/` could be interesting.

Replies are listed 'Best First'.
Re^2: How to debug "Too Many Open Files" Error
by tonyb48 (Novice) on Sep 16, 2008 at 22:40 UTC
    Thanks so much for your quick response. I'm not familiar with the use of "technologies" as you have used it. I have the following "use" statements:
    use strict; use CGI qw(:standard escape escapeHTML); use Authen::Captcha; use Image::Magick; use Data::FormValidator (qw/filter_ucfirst/); use Data::FormValidator (qw/valid_email/); use CGI ':cgi-lib'; use Regexp::Common (qw/profanity/); use lib qw(/var/www/vhosts/cfhs69.com/cgi-bin); use CGI::Carp qw(fatalsToBrowser);
    Is there any way I can run the command you show from inside my script? If not, I can ask my hosting service to run it. Needless to say, they do not invite me to run commands directly on their server. Tony
      Is there any way I can run the command you show from inside my script? If not, I can ask my hosting service to run it. Needless to say, they do not invite me to run commands directly on their server.

      It's important that this command be run by your script a short time before it crashes. Otherwise the output might not be helpful.

      As you have not posted code, I assume that you don't know where the error happens. This makes it difficult to run the command shortly before that, so I suggest putting something like

      warn `ls -l /proc/$$/fd/` . ' ';

      in various places in your code; you will probably see the output in your server log.

      The appended whitespace ' ' ensures that the string does not end in a newline. warn() and die() append the source code line number in that case.

        Thanks! When I have observed the failure, I have noted a couple of processes where failure seems more frequent. I can put this into those modules. Does the output go to the logs only? Or will the user see something? My script still includes the line:
        use CGI::Carp qw(fatalsToBrowser);
        Will that affect what the user sees when the script encounters the warn statement? Thanks, Tony
Re^2: How to debug "Too Many Open Files" Error
by Anonymous Monk on Sep 29, 2008 at 20:56 UTC
    The bug came from that you open files without closing it after using.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://711782]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-19 14:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found