• 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

memory leak error down our site

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
please help me to solve memory leak issue for my java web application.
How i get rid off this issue.
After 2-3 times my site get down. after that I am observing usage of memory by processes.
i observed that day by day free memory of server is decreasing.
please help me.
 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Nitin!

Tomcat does not have a reputation for leaking memory. So any memory leaks are almost certain to be in a webapp, not in Tomcat.

There are various tools that can be used to monitor memory usage in an application, whether it's a stand-alone app or a webapp deployed in Tomcat. That includes the hprof facility that's part of the JVM itself. You should investigate these.
 
nitin yeola
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Tim,

I got following in my tomcat logs
SEVERE: The web application [/web] registered the JDBC driver
[com.mysql.jdbc.Driver] but failed to unregister it when the web application
was stopped. To prevent a memory leak, the JDBC Driver has been forcibly
unregistered.
Mar 20, 2012 9:04:38 AM org.apache.catalina.loader.WebappClassLoader
clearReferencesThreads
SEVERE: The web application [/web] appears to have started a thread
named [Thread-162] but has failed to stop it. This is very likely to create
a memory leak.

can you explain me details about this?
And let me know more about the tools you mentioned in your post..

Thanks in advanced.
 
Saloon Keeper
Posts: 7582
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yep, restarting a web app in a running Tomcat generally leaks memory. That's not really Tomcat's fault, though, and there isn't much you can do about it. Best recourse for a production machine is not to restart web apps, but to restart Tomcat itself.

VisualVM -which comes with the JDK- is a very powerful tool to inspect a JMX-enabled Tomcat instance. If the Tomcat is running on a remote machine you'll need to enable its remote JMX support as well as JMX in general.
 
nitin yeola
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Tim,
One more thing i want to know as I am beginner in it.

What is the difference between restarting web apps and restarting tomcat?

please reply early..
 
Tim Moores
Saloon Keeper
Posts: 7582
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The Tomcat manager web app (a link to which can be found on http://localhost:8080/) allows you to restart individual web apps. That can be useful during debugging, as it is much faster than restarting the entire server.
 
nitin yeola
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
but we restarting tomcat with rctomcat6 script.
Is it tomcat restart?
if it is then how memory leaks occurring?

please reply i have to fix this bug.
 
Tim Moores
Saloon Keeper
Posts: 7582
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As I said, restarting Tomcat is not the same as restarting a web app. I was merely answering your last question, that wasn't a reply to your original problem. VisualVM is still useful for debugging memory issues, but it'll take time to learn and master - it's not a quick fix.
 
Tim Holloway
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The JavaRanch is not a good resource for urgent help. We are all unpaid volunteers, so we are only available when it is convenient for us.

Based on your questions, it sounds like you need to obtain the assistance of someone much more experienced than you are. A lot of us here are more experienced, but we don't know anything about your particular IT shop or the application that you are running that is being so careless with resources.

Restarting Tomcat is no real solution. The messages you are getting are warnings from Tomcat that one or more webapps are not well-written.

To solve the problem would require analysing the failing application(s) themselves and it's more work than most of us can afford to do for free, even if we had the source code for your applications.
 
What's that smell? I think this tiny ad may have stepped in something.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic