sir_com has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks, Please read the below scenario..... I have a linux server in which many applications resides. I am running one application among them. The application creates 4 instance and each instance in turn creates file descriptor according to the request (instance actually called a library...which created the file descriptor). The problem is ... it created the FD but doesn't close it. after a certain time each of the instance (4) reaches the max and system crashed/bogged down and doesn't respond to any of the query. As a user certainly I don't know that this is the application which is culprit. Could any one of you please let me know how to find out the culprit process in above scenario. PS: result of top command show CPU% MEM% as 0/1 for the particular application. Thanks, sir_com
  • Comment on Unclosed File Descriptors cause Application crash

Replies are listed 'Best First'.
Re: Unclosed File Descriptors cause Application crash
by moritz (Cardinal) on Jun 05, 2008 at 10:39 UTC
    Well, close the file handle when it's not needed any more.

    Or what is your problem? no access to the source code of the offending program?

    If a process hogs open file handle until it crashes that's certainly a bug.

      Moritz, That's fine...I understand that it can be a bug of OS level but my question is not that... What I am trying to figure out is...How to identify which process (in my case the application)is the culprit behind this situation. As I have mentioned...top will not be of any use. This is really a weired situation.
        I'd expect the crashing process to be the one which has too many opened file handles.

        On a unixish system you can also consult the output of lsof.

        BTW when you write result of top command show CPU% MEM% as 0/1 for the particular application. I read that as "CPU usage is not a problem", not as "the output isn't helpful for me". Try to actually say what you think, not say something different and hope that everybody else comes to the same conclusions as you.