• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

open file descriptors

 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
We are running into an issue where we are running out of file descriptors that our system may open.
The theory is that someone may not be closing off a resource (file, ldap connection etc) that they have opened. Having spent a good bit of time trying to find the offending code I am now wondering if there is a tool that will resolve the file names of the open descriptors to make my job a bit earier. We have been using jprofiler but it doesn't give any help with this.
If anyone has another way of looking at this I'd appreciate it.
Cheers
 
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you would have to make a minor change to your code, but you could track open files with jamon. Do you have one class that does your io. If so, the basic code would look like the following.

JAMon will track
- how many files are open
- what are the file names
- how long have files been open
- how many total files have been open
- ...more

If you have a web application all this info is viewable via the jamon war. Once you have jamon as part of your code you might as well enable jdbc, log4j, and page hit monitors as they require no code changes. See the link below for more info.

 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try Process Explorer. It will tell you what files are open for a process. It should be a small matter to find where those files are being left open in your code.
 
Barry Higgins
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Steve and Joe,
Unfortunately our app will only run on Linux so process explorer is not an option. I have looked at lsof but this doesn't give enough information to be of use.
I'm going to put something around JAMon in now. There are a large number of places where different people have been using file descriptors but I'm hoping there will be something in the API to help me out.
Thanks I will let you know how I get on.
Barry
 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Barry Higgins:
Unfortunately our app will only run on Linux so process explorer is not an option. I have looked at lsof but this doesn't give enough information to be of use.



I've used lsof to solve this problem on *nix platforms. Exactly what information are you lacking?
 
steve souza
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Note, where I put the variable 'fileName' below you can also add to that any context info that you would like to display in the report. For example the module name that is opening the file. There are many advantages to wrapping low level API's like IO in your own classes. Monitoring is one of them, and consisitent use of the low level api is another.



The context info is further explained in the following jamon documentation.
http://jamonapi.sourceforge.net/jamonlisteners.html

You can play with jamonlisteners in the jamon demo mentioned below.
[ June 05, 2008: Message edited by: steve souza ]
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks that really helped!
 
steve souza
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd be interested in hearing what you did to find the problem and what you found out.
 
Any sufficiently advanced technology will be used as a cat toy. And this tiny ad contains a very small cat:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic