aspose file tools*
The moose likes Tomcat and the fly likes memory leak error down our site Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "memory leak error down our site" Watch "memory leak error down our site" New topic
Author

memory leak error down our site

nitin yeola
Greenhorn

Joined: Mar 27, 2012
Posts: 18
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.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16303
    
  21

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
nitin yeola
Greenhorn

Joined: Mar 27, 2012
Posts: 18
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.
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
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

Joined: Mar 27, 2012
Posts: 18
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
Rancher

Joined: Sep 21, 2011
Posts: 2408
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

Joined: Mar 27, 2012
Posts: 18
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
Rancher

Joined: Sep 21, 2011
Posts: 2408
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

Joined: Jun 25, 2001
Posts: 16303
    
  21

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: memory leak error down our site