Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

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

by betterworld (Deacon)
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.


Comment on Re^3: How to debug "Too Many Open Files" Error
Select or Download Code
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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2014-12-20 20:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (97 votes), past polls