Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

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

by betterworld (Curate)
on Sep 16, 2008 at 22:57 UTC ( #711822=note: print w/replies, xml ) Need Help??

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

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.

Replies are listed 'Best First'.
Re^4: How to debug "Too Many Open Files" Error
by tonyb48 (Novice) on Sep 16, 2008 at 23:15 UTC
    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

      See "Making warnings appear as HTML comments" in CGI::Carp.

        Thanks very much. CGI::Carp has a number of useful options. Printing warnings to browser will help me debug; I might prefer to print them to the error log. Recently I find "Too Many Open Files" in my error log, but the application has not crashed. I prefer my users are not disturbed unneccesarily. Thank you very much. Tony

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://711822]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2017-11-18 14:55 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (277 votes). Check out past polls.