Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

handle leak

 
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I have a Java application with a handle leak inside. Are there any tools to investigate this?

With "Process Explorer" I could see the Handle number increasing but I have no clue about what is the type of handle generating the pb.

Thanks,
Cristian
 
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
Is this an application you have written? Without the source you will not be able to do much about a resource leak.
What does the application do? Is it processing files or reading from a DB? If those resources are not properly closed they may cause leaks. In the try-catch-finally block surrounding such interactions, make sure the files and db connections are closed in the finally block.
There are tools like JConsole, which can track class instances and memory usage and help you track down resource leaks.
 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What OS are you running on ? If you are on Linux or Solaris, try using Auptyma's Java Application Monitor. You don't need access to your application source code, and you can use it to take multiple snapshots of your system and compare them to see what objects/instances/JNI Handles etc have grown, and where they are reachable from.
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you tried the "poor man's troubleshooter" namely code traces. If you know what handle is increasing it should be quite easy to track down the problem.
[ December 31, 2005: Message edited by: uj johansson ]
 
Cristian Negresco
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

The code wasn't written by me, I even had to consider code which was not available.
The problem seemed to be in the try-catch-finally as Joe Ess suggested. I was not sure this was the problem as I found the faulty pattern in many places and kept correcting it. Until suddenly the problem disappeared.

And the error itself was due to an aleatory appearance of a http connection exception due to a rather small "sun.net.client.defaultConnectTimeout".
After closing the connections in finally and empirically chosing a bigger defaultConnectTimeout the pb. disappeared.
Thanks,
Cristian

PS: Sorry for late answer, this was solved quite a while ago.
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Aleatory" is such a nice word. I've rarely seen it in the wild, mostly in text books as a music major. Glad you found the bug!
[ August 14, 2006: Message edited by: Stan James ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic