Tomcat Memory Leak
Hey, I sent it today but I'm not sure it was sent, so I'm sending again (and that's the last time :)). I work in a company which we use Tomcat (5.5.26 , and recently we've upgraded it to 6.0.29) to run our application. The tomcat is running on servers with OS windows 2008 R2 STD. The problem is- Until now, we used SQL Authentication for the tomcat service and configuration (user and password for tomcat to access the DB was provided within the xml configuration file, under c:\Program Files\Apache Software Foundation\Tomcat 6.0\conf\catalina\localhost), but - since we changed configuration to use SSO - Windows Authentication (the user that runs tomcat is now a domain user with permissions on the DB + removed user and password from xml configuration file), we observed a trend of memory leak, where it comes to attention by the process of tomcat, which is increasing on a daily basis. Do you know why is it happening? What can I do to stop the memory leak (other than switching back to SQL authentication)? Any suggestions via mail (hilavalen...@gmail.com) would be highly appreciated. Thanks Hila
Re: Tomcat memory leak error launching web app in NetBeans 6.9.1
On 20/10/2010 12:41, Martin O'Shea wrote: And then when I terminate the Quartz application, but leave Tomcat running, the second dump appears to be show no trace of these messages at all. So does this indicate that Quartz has shut down but only after my application has stopped within Tomcat, i.e. that Tomcat monitors my application's demise and reports the threads as extant because Quartz has not yet ended? The memory leak detection activates when a web app stops. The question is whether the Quartz scheduler blocks and waits for its worker threads to finish before it reports that it's shutdown. I don't believe it does, which isn't your fault. p 0x62590808.asc Description: application/pgp-keys signature.asc Description: OpenPGP digital signature
RE: Tomcat memory leak error launching web app in NetBeans 6.9.1
Thanks for this. I've copied the logs over to an incident in Quartz's forum so hopefully, I can get to the bottom of this issue. http://forums.terracotta.org/forums/posts/list/4341.page -Original Message- From: Pid [mailto:p...@pidster.com] Sent: 20 Oct 2010 16 37 To: Tomcat Users List Subject: Re: Tomcat memory leak error launching web app in NetBeans 6.9.1 On 20/10/2010 12:41, Martin O'Shea wrote: And then when I terminate the Quartz application, but leave Tomcat running, the second dump appears to be show no trace of these messages at all. So does this indicate that Quartz has shut down but only after my application has stopped within Tomcat, i.e. that Tomcat monitors my application's demise and reports the threads as extant because Quartz has not yet ended? The memory leak detection activates when a web app stops. The question is whether the Quartz scheduler blocks and waits for its worker threads to finish before it reports that it's shutdown. I don't believe it does, which isn't your fault. p - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Heading [OT] Re: Tomcat memory leak error launching web app in NetBeans 6.9.1
On 19/10/2010 01:07, Mark Eggers wrote: Once again, I apologize for the wall of text. However, most of it is pretty quick and dirty code, so it should be easy to skim. I'm guessing the end result is harmless? Well, if the ClassLoader is still extant after it's supposed to have been cleared up, it isn't so harmless. It does seem like a race condition. Everything seems to work fine until shutdown. When DEBUG is set in logging, you get the following in catalina.out: snip org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:595) Here's the relevant portions of the class in question (both from org.quartz.simpl.SimpleThreadPool): try { getLog().debug(WorkerThread is shut down.); } catch(Exception e) { // ignore to help with a tomcat glitch } A Tomcat glitch? Maybe we should find out what that was, given the edit was 5 years ago... And part of the shutdown code - lots of hard-coded wait times: public void shutdown(boolean waitForJobsToComplete) { synchronized (nextRunnableLock) { isShutdown = true; if(workers == null) // case where the pool wasn't even initialize()ed return; // signal each worker thread to shut down Iterator workerThreads = workers.iterator(); while(workerThreads.hasNext()) { WorkerThread wt = (WorkerThread) workerThreads.next(); wt.shutdown(); This is where the thread is told to shutdown. availWorkers.remove(wt); } // Give waiting (wait(1000)) worker threads a chance to shut down. It's 1000 in the comment here ^^ // Active worker threads will shut down after finishing their // current job. nextRunnableLock.notifyAll(); if (waitForJobsToComplete == true) { // wait for hand-off in runInThread to complete... while(handoffPending) { try { nextRunnableLock.wait(100); } catch(Throwable t) {} } It's 100 here ^^ // Wait until all worker threads are shut down while (busyWorkers.size() 0) { WorkerThread wt = (WorkerThread) busyWorkers.getFirst(); try { getLog().debug( Waiting for thread + wt.getName() + to shut down); // note: with waiting infinite time the // application may appear to 'hang'. nextRunnableLock.wait(2000); It's 2000 here ^^ } catch (InterruptedException ex) { } } getLog().debug(shutdown complete); } } } Looking at the above code, there's a wait of 2.1 seconds per thread? If that's the case, then the 3 threads will take up to 6.3 seconds while waiting. 6.1s, the 100ms wait only happens once doesn't it? What's odd is that I don't see the entry: Waiting for thread name to shut down in any of the logs. You'd need to set 'debug' on Quartz the package the class is in, I guess. Here's some admittedly ugly code I put together: snip Tangent: I wonder if removing each Job from the Scheduler prior to shutdown has a bearing on Quartz ability to find stop them. Tomcat's log message reports that the threads aren't actually stopped, so does Quartz actually wait for them to stop, or does it just wait for 2secs and then move on to the next thread? Quartz doesn't seem to be aware that the job thread is still running. p 0x62590808.asc Description: application/pgp-keys signature.asc Description: OpenPGP digital signature
Re: Tomcat memory leak error launching web app in NetBeans 6.9.1
Well, I've tried Mark's code earlier, albeit without using a properties file for Log4J, and the position has improved slightly. The log indicates the following: INFO: Pausing Coyote AJP/1.3 on ajp-8009 Job Job1 unsubmitted at 2010-10-19 15:18:10 24047 [main] INFO org.quartz.core.QuartzScheduler - Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED shutting down. 24047 [main] INFO org.quartz.core.QuartzScheduler - Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED paused. 24047 [main] INFO org.quartz.core.QuartzScheduler - Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED shutdown complete. Shutting down scheduler 19-Oct-2010 15:18:10 org.apache.catalina.core.StandardService stop INFO: Stopping service Catalina 19-Oct-2010 15:18:10 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads SEVERE: A web application appears to have started a thread named [DefaultQuartzScheduler_Worker-1] but has failed to stop it. This is very likely to create a memory leak. 19-Oct-2010 15:18:10 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads SEVERE: A web application appears to have started a thread named [DefaultQuartzScheduler_Worker-2] but has failed to stop it. This is very likely to create a memory leak. 19-Oct-2010 15:18:10 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads SEVERE: A web application appears to have started a thread named [DefaultQuartzScheduler_Worker-3] but has failed to stop it. This is very likely to create a memory leak. 19-Oct-2010 15:18:10 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads SEVERE: A web application appears to have started a thread named [DefaultQuartzScheduler_Worker-4] but has failed to stop it. This is very likely to create a memory leak. 19-Oct-2010 15:18:10 org.apache.coyote.http11.Http11AprProtocol destroy INFO: Stopping Coyote HTTP/1.1 on http-8084 19-Oct-2010 15:18:10 org.apache.coyote.ajp.AjpAprProtocol destroy INFO: Stopping Coyote AJP/1.3 on ajp-8009 Where there are fewer messages but it still seems as if Tomcat is detecting Quartz threads after Quartz is shut down. So my simple question becomes: do these messages matter if Tomcat is restarted or if the host server (which starts Tomcat as a Windows service) is rebooted? -- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Tomcat memory leak error launching web app in NetBeans 6.9.1
From: app...@dsl.pipex.com [mailto:app...@dsl.pipex.com] Subject: Re: Tomcat memory leak error launching web app in NetBeans 6.9.1 Where there are fewer messages but it still seems as if Tomcat is detecting Quartz threads after Quartz is shut down. Which means Quartz isn't really shutting down. As suggested before, take some thread dumps and find out what the threads are doing that prevents them from going away. That may uncover some other problem in your webapp. So my simple question becomes: do these messages matter if Tomcat is restarted or if the host server (which starts Tomcat as a Windows service) is rebooted? No. However, I would be concerned that this aberration is just a symptom of something more serious that might be wrong. For example, are the threads stuck on some lock that they shouldn't be? Are other resources tied up that might cause instability over the long term? Sweeping the problem under the rug by rebooting would leave me a bit uneasy. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Tomcat memory leak error launching web app in NetBeans 6.9.1
Are you able to advise how this may be done within NetBeans 6.9.1 / Tomcat 6.0.26? Thanks. Quoting Caldarale, Charles R chuck.caldar...@unisys.com: From: app...@dsl.pipex.com [mailto:app...@dsl.pipex.com] Subject: Re: Tomcat memory leak error launching web app in NetBeans 6.9.1 Where there are fewer messages but it still seems as if Tomcat is detecting Quartz threads after Quartz is shut down. Which means Quartz isn't really shutting down. As suggested before, take some thread dumps and find out what the threads are doing that prevents them from going away. That may uncover some other problem in your webapp. So my simple question becomes: do these messages matter if Tomcat is restarted or if the host server (which starts Tomcat as a Windows service) is rebooted? No. However, I would be concerned that this aberration is just a symptom of something more serious that might be wrong. For example, are the threads stuck on some lock that they shouldn't be? Are other resources tied up that might cause instability over the long term? Sweeping the problem under the rug by rebooting would leave me a bit uneasy. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org -- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat memory leak error launching web app in NetBeans 6.9.1
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Martin, On 10/16/2010 11:11 AM, Martin O'Shea wrote: Definitely seems to be when the web application in question is terminated, rather than Tomcat itself. And all indications are the listener that handles the scheduler. And I've tried another similar application which gives messages of the same kind. And yet both apps have worked under other environments. Note that the leak detection has been added and improved in recent Tomcat versions. It's possible that this problem has always been there, you're just never been notified about it. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAky8QkkACgkQ9CaO5/Lv0PAwNACfVwsejeJhSe3CajEWqQraiXTf amwAoI8Kl+4V07E7Tv4Axn8ASiJRq8Pm =9dxR -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Tomcat memory leak error launching web app in NetBeans 6.9.1
You're probably correct and assuming this is to do with Quartz which it seems to be, are you aware of any similar cases or remedies? -Original Message- From: Christopher Schultz [mailto:ch...@christopherschultz.net] Sent: 18 Oct 2010 13 49 To: Tomcat Users List Subject: Re: Tomcat memory leak error launching web app in NetBeans 6.9.1 -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Martin, On 10/16/2010 11:11 AM, Martin O'Shea wrote: Definitely seems to be when the web application in question is terminated, rather than Tomcat itself. And all indications are the listener that handles the scheduler. And I've tried another similar application which gives messages of the same kind. And yet both apps have worked under other environments. Note that the leak detection has been added and improved in recent Tomcat versions. It's possible that this problem has always been there, you're just never been notified about it. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAky8QkkACgkQ9CaO5/Lv0PAwNACfVwsejeJhSe3CajEWqQraiXTf amwAoI8Kl+4V07E7Tv4Axn8ASiJRq8Pm =9dxR -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat memory leak error launching web app in NetBeans 6.9.1
I saw a mention of this on the Quartz forums. People there seem to think it's a race condition between Quartz's scheduler shutdown and Tomcat's thread memory leak reporting. I wrote a quick Quartz scheduler (1.8.3) application. It does the following: 1. Uses the supplied listener to put a scheduler factory in the servlet context (org.quartz.ee.servlet.QuartzInitializerListener) 2. Uses another listener to add a job that writes to a log file every 5 minutes 3. Uses the provided listener (org.quartz.ee.servlet.QuartzInitializerListener) to shut down all schedulers The supplied listener is configured via parameters to start the scheduler on startup, and shut down the scheduler on application termination. When I watch this using visualvm (1.3.1) on Tomcat 6.0.18 and 6.0.29, I see the four threads that are started by Quartz vanish when the application is undeployed. Tomcat reports the SEVERE error for some of these threads in catalina.out. I ran the test twice and I think that Tomcat reported different threads on each run (didn't save the log files). I also didn't look for any stray classes left after the application was undeployed. The supplied listener can be configured to not start or shut down the scheduler. Starting and shutting down the scheduler can then be managed by the second listener (that adds the job). I've not tried this yet. Finally, there are two ways to shut down the scheduler. The default (graceful) way waits for any pending jobs to complete. Calling shutdown(false) immediately terminates the scheduler. This doesn't seem to be configurable using the supplied listener, so the scheduler would have to be managed by the second listener. Environment: OS: Fedora 13 2.6.34.7-56.fc13.i686 Java:Oracle/Sun Java JRE/JDK 1.6.0_22 IDE: NetBeans 6.9.1 / Maven 2.2.1 Tomcat: 6.0.29 6.0.18 Quartz: 1.8.3 Monitor: VisualVM 1.3.1 (https://visualvm.dev.java.net/) If I have some time today, I'll try some variations. . . . . just my two cents. /mde/ - Original Message From: Martin O'Shea app...@dsl.pipex.com To: Tomcat Users List users@tomcat.apache.org Sent: Mon, October 18, 2010 5:52:08 AM Subject: RE: Tomcat memory leak error launching web app in NetBeans 6.9.1 You're probably correct and assuming this is to do with Quartz which it seems to be, are you aware of any similar cases or remedies? -Original Message- From: Christopher Schultz [mailto:ch...@christopherschultz.net] Sent: 18 Oct 2010 13 49 To: Tomcat Users List Subject: Re: Tomcat memory leak error launching web app in NetBeans 6.9.1 -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Martin, On 10/16/2010 11:11 AM, Martin O'Shea wrote: Definitely seems to be when the web application in question is terminated, rather than Tomcat itself. And all indications are the listener that handles the scheduler. And I've tried another similar application which gives messages of the same kind. And yet both apps have worked under other environments. Note that the leak detection has been added and improved in recent Tomcat versions. It's possible that this problem has always been there, you're just never been notified about it. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAky8QkkACgkQ9CaO5/Lv0PAwNACfVwsejeJhSe3CajEWqQraiXTf amwAoI8Kl+4V07E7Tv4Axn8ASiJRq8Pm =9dxR -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat memory leak error launching web app in NetBeans 6.9.1
On 18/10/2010 12:05, Mark Eggers wrote: I saw a mention of this on the Quartz forums. People there seem to think it's a race condition between Quartz's scheduler shutdown and Tomcat's thread memory leak reporting. That is certainly possible. There was a reason I wrote the message This is very likely to create a memory leak. rather than There is a memory leak. Options to consider: - is there a way to perform a synchronous shutdown of the scheduler? - can you detect if the scheduler has not shutdown an loop (for a limited time) waiting for it to finish? Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat memory leak error launching web app in NetBeans 6.9.1
On 18/10/2010 16:56, Mark Thomas wrote: On 18/10/2010 12:05, Mark Eggers wrote: I saw a mention of this on the Quartz forums. People there seem to think it's a race condition between Quartz's scheduler shutdown and Tomcat's thread memory leak reporting. That is certainly possible. There was a reason I wrote the message This is very likely to create a memory leak. rather than There is a memory leak. Options to consider: - is there a way to perform a synchronous shutdown of the scheduler? - can you detect if the scheduler has not shutdown an loop (for a limited time) waiting for it to finish? Something that occurred to me just after I hit send. These threads really need to finish up *before* Tomcat shuts down the context. Tomcat does a bunch of clean-up stuff to prevent memory leaks and if application code is still running when the clean-up code runs the clean-up could easily fail. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat memory leak error launching web app in NetBeans 6.9.1
On 18/10/2010 18:19, Martin O'Shea wrote: Thanks Mark. Your test seems to bear out the issue I'm having. For information: I have my own ServletContextListener which has a contextDestroyed method as follows: @Override public void contextDestroyed(ServletContextEvent contextEvent) { context = contextEvent.getServletContext(); Scheduler_Controller sc = new Scheduler_Controller(); // Is scheduler stopped? try { if (sc.isSchedulerStopped()) { System.out.println(The scheduler is already stopped.); } else { try { sc.stopScheduler(); System.out.println(The scheduler has been stopped.); } catch(Exception ex) { logger.error(Error stopping scheduler\n + ex); } } } catch(Exception ex) { logger.error(Error stopping scheduler\n, ex); } } Methods isSchedulerStopped and stopScheduler follow: public boolean isSchedulerStopped() throws Exception { SchedulerFactory sf = new StdSchedulerFactory(); Scheduler scheduler = sf.getScheduler(); scheduler = StdSchedulerFactory.getDefaultScheduler(); Why create a new factory and object each time, rather than when the owning object is created - in the constructor? Why use a controller object? It would be simpler to just create it all in the ServletContextListener, wouldn't it? p if (scheduler.isShutdown()) { return true; } else { return false; } } public void stopScheduler() throws Exception { SchedulerFactory sf = new StdSchedulerFactory(); Scheduler scheduler = sf.getScheduler(); scheduler = StdSchedulerFactory.getDefaultScheduler(); Scheduler_Job sj = null; // First scheduled job. try { sj = Scheduler_Job_DB.get(1); scheduler.unscheduleJob(sj.getJobName(), scheduler.DEFAULT_GROUP); System.out.println(Job + sj.getJobName() + unsubmitted.); } catch(Exception ex){ logger.error(Error unsubmitting job + sj.getJobName() + \n, ex); } // Second scheduled job. try { sj = Scheduler_Job_DB.get(2); scheduler.unscheduleJob(sj.getJobName(), scheduler.DEFAULT_GROUP); System.out.println(Job + sj.getJobName() + unsubmitted.); } catch(Exception ex){ logger.error(Error unsubmitting job + sj.getJobName() + \n, ex); } scheduler.shutdown(true); if (scheduler.isShutdown()) { System.out.println(Scheduler stopped); } } So I think that according to these, the scheduler should end 'gracefully' by unsubmitting the jobs and by using scheduler.shutdown(true);. If I'm wrong, please let me know. -Original Message- From: Mark Eggers [mailto:its_toas...@yahoo.com] Sent: 18 Oct 2010 18 06 To: Tomcat Users List Subject: Re: Tomcat memory leak error launching web app in NetBeans 6.9.1 I saw a mention of this on the Quartz forums. People there seem to think it's a race condition between Quartz's scheduler shutdown and Tomcat's thread memory leak reporting. I wrote a quick Quartz scheduler (1.8.3) application. It does the following: 1. Uses the supplied listener to put a scheduler factory in the servlet context (org.quartz.ee.servlet.QuartzInitializerListener) 2. Uses another listener to add a job that writes to a log file every 5 minutes 3. Uses the provided listener (org.quartz.ee.servlet.QuartzInitializerListener) to shut down all schedulers The supplied listener is configured via parameters to start the scheduler on startup, and shut down the scheduler on application termination. When I watch this using visualvm (1.3.1) on Tomcat 6.0.18 and 6.0.29, I see the four threads that are started by Quartz vanish when the application is undeployed. Tomcat reports the SEVERE error for some of these threads in catalina.out. I ran the test twice and I think that Tomcat reported different threads on each run (didn't save the log files). I also didn't look for any stray classes left after the application was undeployed. The supplied listener can be configured to not start or shut down the scheduler. Starting and shutting down the scheduler can then be managed by the second listener (that adds the job). I've not tried this yet. Finally, there are two ways to shut down the scheduler. The default (graceful) way waits for any pending jobs to complete. Calling shutdown(false) immediately terminates the scheduler. This doesn't seem to be configurable using the supplied listener, so the scheduler would have to be managed by the second listener
Re: Tomcat memory leak error launching web app in NetBeans 6.9.1
On 18/10/2010 23:02, Mark Thomas wrote: On 18/10/2010 16:56, Mark Thomas wrote: On 18/10/2010 12:05, Mark Eggers wrote: I saw a mention of this on the Quartz forums. People there seem to think it's a race condition between Quartz's scheduler shutdown and Tomcat's thread memory leak reporting. That is certainly possible. There was a reason I wrote the message This is very likely to create a memory leak. rather than There is a memory leak. Options to consider: - is there a way to perform a synchronous shutdown of the scheduler? - can you detect if the scheduler has not shutdown an loop (for a limited time) waiting for it to finish? Something that occurred to me just after I hit send. These threads really need to finish up *before* Tomcat shuts down the context. Tomcat does a bunch of clean-up stuff to prevent memory leaks and if application code is still running when the clean-up code runs the clean-up could easily fail. Calling scheduler.shutdown(true); /should/ cause it to block wait for existing jobs to finish. The Quartz supplied Listener does appear to do this: http://svn.terracotta.org/fisheye/browse/Quartz/trunk/quartz/src/main/java/org/quartz/ee/servlet/QuartzInitializerListener.java?r=HEAD p 0x62590808.asc Description: application/pgp-keys signature.asc Description: OpenPGP digital signature
Re: Tomcat memory leak error launching web app in NetBeans 6.9.1
That's what I've read and from the code it's the default. I'm hacking together a listener that rolls the entire chain from scratch rather than depending on the Quartz-supplied listener. I'll add some debugging logging and see what happens. I might also try just creating the SchedulerFactory first, then getting a scheduler, then starting the scheduler, and finally adding a job. - Original Message From: Pid p...@pidster.com To: Tomcat Users List users@tomcat.apache.org Sent: Mon, October 18, 2010 3:15:28 PM Subject: Re: Tomcat memory leak error launching web app in NetBeans 6.9.1 On 18/10/2010 23:02, Mark Thomas wrote: On 18/10/2010 16:56, Mark Thomas wrote: On 18/10/2010 12:05, Mark Eggers wrote: I saw a mention of this on the Quartz forums. People there seem to think it's a race condition between Quartz's scheduler shutdown and Tomcat's thread memory leak reporting. That is certainly possible. There was a reason I wrote the message This is very likely to create a memory leak. rather than There is a memory leak. Options to consider: - is there a way to perform a synchronous shutdown of the scheduler? - can you detect if the scheduler has not shutdown an loop (for a limited time) waiting for it to finish? Something that occurred to me just after I hit send. These threads really need to finish up *before* Tomcat shuts down the context. Tomcat does a bunch of clean-up stuff to prevent memory leaks and if application code is still running when the clean-up code runs the clean-up could easily fail. Calling scheduler.shutdown(true); /should/ cause it to block wait for existing jobs to finish. The Quartz supplied Listener does appear to do this: http://svn.terracotta.org/fisheye/browse/Quartz/trunk/quartz/src/main/java/org/quartz/ee/servlet/QuartzInitializerListener.java?r=HEAD p - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat memory leak error launching web app in NetBeans 6.9.1
Once again, I apologize for the wall of text. However, most of it is pretty quick and dirty code, so it should be easy to skim. I'm guessing the end result is harmless? It does seem like a race condition. Everything seems to work fine until shutdown. When DEBUG is set in logging, you get the following in catalina.out: Oct 18, 2010 4:12:38 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads SEVERE: The web application [/QSchedule] appears to have started a thread named [SampleScheduler_Worker-1] but has failed to stop it. This is very likely to create a memory leak. Oct 18, 2010 4:12:38 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads SEVERE: The web application [/QSchedule] appears to have started a thread named [SampleScheduler_Worker-2] but has failed to stop it. This is very likely to create a memory leak. Oct 18, 2010 4:12:38 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads SEVERE: The web application [/QSchedule] appears to have started a thread named [SampleScheduler_Worker-3] but has failed to stop it. This is very likely to create a memory leak. Oct 18, 2010 4:12:38 PM org.apache.catalina.loader.WebappClassLoader loadClass INFO: Illegal access: this web application instance has been stopped already. Could not load java.io.PrintStream. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact. java.lang.IllegalStateException at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1531) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491) at org.apache.log4j.helpers.LogLog.error(LogLog.java:142) at org.apache.log4j.helpers.PatternParser$DatePatternConverter.convert(PatternParser.java:447) at org.apache.log4j.helpers.PatternConverter.format(PatternConverter.java:64) at org.apache.log4j.PatternLayout.format(PatternLayout.java:503) at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:301) at org.apache.log4j.WriterAppender.append(WriterAppender.java:159) at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230) at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:65) at org.apache.log4j.Category.callAppenders(Category.java:203) at org.apache.log4j.Category.forcedLog(Category.java:388) at org.apache.log4j.Category.log(Category.java:853) at org.slf4j.impl.Log4jLoggerAdapter.debug(Log4jLoggerAdapter.java:204) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:595) log4j:ERROR Error occured while converting date. java.lang.NullPointerException at java.lang.AbstractStringBuilder.append(Unknown Source) at java.lang.StringBuffer.append(Unknown Source) at org.apache.log4j.helpers.ISO8601DateFormat.format(ISO8601DateFormat.java:132) at java.text.DateFormat.format(Unknown Source) at org.apache.log4j.helpers.PatternParser$DatePatternConverter.convert(PatternParser.java:444) at org.apache.log4j.helpers.PatternConverter.format(PatternConverter.java:64) at org.apache.log4j.PatternLayout.format(PatternLayout.java:503) at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:301) at org.apache.log4j.WriterAppender.append(WriterAppender.java:159) at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230) at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:65) at org.apache.log4j.Category.callAppenders(Category.java:203) at org.apache.log4j.Category.forcedLog(Category.java:388) at org.apache.log4j.Category.log(Category.java:853) at org.slf4j.impl.Log4jLoggerAdapter.debug(Log4jLoggerAdapter.java:204) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:595) log4j:ERROR Error occured while converting date. java.lang.NullPointerException at java.lang.AbstractStringBuilder.append(Unknown Source) at java.lang.StringBuffer.append(Unknown Source) at org.apache.log4j.helpers.ISO8601DateFormat.format(ISO8601DateFormat.java:132) at java.text.DateFormat.format(Unknown Source) at org.apache.log4j.helpers.PatternParser$DatePatternConverter.convert(PatternParser.java:444) at org.apache.log4j.helpers.PatternConverter.format(PatternConverter.java:64) at org.apache.log4j.PatternLayout.format(PatternLayout.java:503) at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:301) at org.apache.log4j.WriterAppender.append(WriterAppender.java:159) at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230) at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:65) at org.apache.log4j.Category.callAppenders(Category.java:203) at org.apache.log4j.Category.forcedLog(Category.java:388) at org.apache.log4j.Category.log(Category.java:853) at org.slf4j.impl.Log4jLoggerAdapter.debug(Log4jLoggerAdapter.java:204)
RE: Tomcat memory leak error launching web app in NetBeans 6.9.1
Well, I've upgraded to Quartz 1.8.3 and the two SLF4J files that seem to be needed. I believe Quartz's config is correct with regards to the two scheduled jobs I have. But upon terminating my web app in Tomcat or terminating Tomcat, I still find a number of messages: -Oct-2010 14:40:52 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads SEVERE: A web application appears to have started a thread named [DefaultQuartzScheduler_Worker-1] but has failed to stop it. This is very likely to create a memory leak. Any clues? - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Tomcat memory leak error launching web app in NetBeans 6.9.1
Hello I wonder if anyone can help here? I am developing a web application written in Java servlets and JSPs which uses Quartz 1.6.1 to submit two jobs when Apache Tomcat 6.0.26 is started and hourly after that. But what I'm finding is that a message is issued several times as the server is started in NetBeans 6.9.1. The message is: 16-Oct-2010 12:20:18 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads SEVERE: A web application appears to have started a thread named [DefaultQuartzScheduler_Worker-1] but has failed to stop it. This is very likely to create a memory leak. Has anyone any idea? It seems to be causing Tomcat to stop every so often requiring a PC reboot. And I've found very little about this so far. I don't know if it is a problem with Tomcat or Quartz so any help is welcome Thanks Martin O'Shea.
RE: Tomcat memory leak error launching web app in NetBeans 6.9.1
From: Martin O'Shea [mailto:app...@dsl.pipex.com] Subject: Tomcat memory leak error launching web app in NetBeans 6.9.1 16-Oct-2010 12:20:18 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads SEVERE: A web application appears to have started a thread named [DefaultQuartzScheduler_Worker-1] but has failed to stop it. This is very likely to create a memory leak. The above message is displayed when a webapp is *stopped*, not started (including Tomcat shutdown). I don't know if it is a problem with Tomcat or Quartz so any help is welcome Neither - it's an error in your webapp due to its failure to manage resources that it is using. If your webapp starts a thread, your webapp must be prepared to stop the thread during shutdown. This is usually accomplished by configuring and implementing a ServletContextListener in your webapp. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat memory leak error launching web app in NetBeans 6.9.1
On 16 Oct 2010, at 12:45, Martin O'Shea app...@dsl.pipex.com wrote: Hello I wonder if anyone can help here? I am developing a web application written in Java servlets and JSPs which uses Quartz 1.6.1 to submit two jobs when Apache Tomcat 6.0.26 is started and hourly after that. But what I'm finding is that a message is issued several times as the server is started in NetBeans 6.9.1. The message is: 16-Oct-2010 12:20:18 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads SEVERE: A web application appears to have started a thread named [DefaultQuartzScheduler_Worker-1] but has failed to stop it. This is very likely to create a memory leak. Yes. So, umm, your webapp uses quartz - which is starting threads and not stopping them. Has anyone any idea? It seems to be causing Tomcat to stop every so often requiring a PC reboot. And I've found very little about this so far. The error message is issued by Tomcat when an app is stopped and it finds resources that haven't been properly terminated. The message itself is doesn't cause a leak, the source of the problem might - as the message itself states. I don't know if it is a problem with Tomcat or Quartz so any help is welcome Quartz, or the way you've configured it. p Thanks Martin O'Shea. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Tomcat memory leak error launching web app in NetBeans 6.9.1
OK. So the error is happening as the application is closed, not as it started. My mistake. But Tomcat restarts occur frequently as I have NetBeans's Deploy on Save set. This seems to restart the server with the current objects. But what I don't understand is why the ServletContextListener which handles Quartz jobs should be going wrong? It is set to start and stop Quartz at contextInitialized and contextDestroyed times where the former creates an instance of a SchedulerController class which submits the two jobs. This problem never appeared to happen under NetBeans 6.9 with an earlier version of Tomcat which I was using recently. And I wonder if this may have anything to do with the Tomcat out of memory messages I've been receiving? Do I need to increase the memory allocated to the JVM for Tomcat at all? -Original Message- From: Pid * [mailto:p...@pidster.com] Sent: 16 Oct 2010 15 06 To: Tomcat Users List Subject: Re: Tomcat memory leak error launching web app in NetBeans 6.9.1 On 16 Oct 2010, at 12:45, Martin O'Shea app...@dsl.pipex.com wrote: Hello I wonder if anyone can help here? I am developing a web application written in Java servlets and JSPs which uses Quartz 1.6.1 to submit two jobs when Apache Tomcat 6.0.26 is started and hourly after that. But what I'm finding is that a message is issued several times as the server is started in NetBeans 6.9.1. The message is: 16-Oct-2010 12:20:18 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads SEVERE: A web application appears to have started a thread named [DefaultQuartzScheduler_Worker-1] but has failed to stop it. This is very likely to create a memory leak. Yes. So, umm, your webapp uses quartz - which is starting threads and not stopping them. Has anyone any idea? It seems to be causing Tomcat to stop every so often requiring a PC reboot. And I've found very little about this so far. The error message is issued by Tomcat when an app is stopped and it finds resources that haven't been properly terminated. The message itself is doesn't cause a leak, the source of the problem might - as the message itself states. I don't know if it is a problem with Tomcat or Quartz so any help is welcome Quartz, or the way you've configured it. p Thanks Martin O'Shea. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Tomcat memory leak error launching web app in NetBeans 6.9.1
From: Martin O'Shea [mailto:app...@dsl.pipex.com] Subject: RE: Tomcat memory leak error launching web app in NetBeans 6.9.1 I have NetBeans's Deploy on Save set. This seems to restart the server with the current objects. No, it restarts the webapp, not the server. But what I don't understand is why the ServletContextListener which handles Quartz jobs should be going wrong? Time to add some debugging info to it and find out. Is your ServletContextListener even being called? Are you really running the configuration you think you are? (IDEs tend to obfuscate the situation, which is why a lot of us will not attempt to run Tomcat under an IDE.) And I wonder if this may have anything to do with the Tomcat out of memory messages I've been receiving? Sounds like a separate topic for a separate thread. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
RE: Tomcat memory leak error launching web app in NetBeans 6.9.1
I know that the ServletContextListener is running when the application starts because of messages issued from it. It is also calling the two Quartz jobs which appear to be running normally as well. When the application is terminated, e.g. when the server is stopped, appropriate messages are issued to confirm that the scheduler has stopped. Then come the messages about the memory leak. And the configuration is the only one on this PC, Tomcat 6.0.26 using JVM 1.6.0_21-b07. I'm using JDK 1.6.0_21. -Original Message- From: Caldarale, Charles R [mailto:chuck.caldar...@unisys.com] Sent: 16 Oct 2010 15 30 To: Tomcat Users List Subject: RE: Tomcat memory leak error launching web app in NetBeans 6.9.1 From: Martin O'Shea [mailto:app...@dsl.pipex.com] Subject: RE: Tomcat memory leak error launching web app in NetBeans 6.9.1 I have NetBeans's Deploy on Save set. This seems to restart the server with the current objects. No, it restarts the webapp, not the server. But what I don't understand is why the ServletContextListener which handles Quartz jobs should be going wrong? Time to add some debugging info to it and find out. Is your ServletContextListener even being called? Are you really running the configuration you think you are? (IDEs tend to obfuscate the situation, which is why a lot of us will not attempt to run Tomcat under an IDE.) And I wonder if this may have anything to do with the Tomcat out of memory messages I've been receiving? Sounds like a separate topic for a separate thread. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Tomcat memory leak error launching web app in NetBeans 6.9.1
From: Martin O'Shea [mailto:app...@dsl.pipex.com] Subject: RE: Tomcat memory leak error launching web app in NetBeans 6.9.1 When the application is terminated, e.g. when the server is stopped, appropriate messages are issued to confirm that the scheduler has stopped. What about when it's just the webapp being stopped, not the whole server? Try stopping just the webapp, then take a thread dump of Tomcat to see if the quartz threads are really still there. If they are, then the shutdown logic in the listener isn't working. And the configuration is the only one on this PC, Tomcat 6.0.26 using JVM 1.6.0_21-b07. I'm using JDK 1.6.0_21. IDEs have a nasty habit of substituting their own Tomcat and webapp configurations rather than using the ones you think you've set up. You won't find additional Tomcat or JDK installations, just behavior that's not consistent with what you configured. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
RE: Tomcat memory leak error launching web app in NetBeans 6.9.1
Definitely seems to be when the web application in question is terminated, rather than Tomcat itself. And all indications are the listener that handles the scheduler. And I've tried another similar application which gives messages of the same kind. And yet both apps have worked under other environments. -Original Message- From: Caldarale, Charles R [mailto:chuck.caldar...@unisys.com] Sent: 16 Oct 2010 15 53 To: Tomcat Users List Subject: RE: Tomcat memory leak error launching web app in NetBeans 6.9.1 From: Martin O'Shea [mailto:app...@dsl.pipex.com] Subject: RE: Tomcat memory leak error launching web app in NetBeans 6.9.1 When the application is terminated, e.g. when the server is stopped, appropriate messages are issued to confirm that the scheduler has stopped. What about when it's just the webapp being stopped, not the whole server? Try stopping just the webapp, then take a thread dump of Tomcat to see if the quartz threads are really still there. If they are, then the shutdown logic in the listener isn't working. And the configuration is the only one on this PC, Tomcat 6.0.26 using JVM 1.6.0_21-b07. I'm using JDK 1.6.0_21. IDEs have a nasty habit of substituting their own Tomcat and webapp configurations rather than using the ones you think you've set up. You won't find additional Tomcat or JDK installations, just behavior that's not consistent with what you configured. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat memory leak error launching web app in NetBeans 6.9.1
On 16/10/2010 15:24, Martin O'Shea wrote: OK. So the error is happening as the application is closed, not as it started. My mistake. But Tomcat restarts occur frequently as I have NetBeans's Deploy on Save set. This seems to restart the server with the current objects. But what I don't understand is why the ServletContextListener which handles Quartz jobs should be going wrong? It is set to start and stop Quartz at contextInitialized and contextDestroyed times where the former creates an instance of a SchedulerController class which submits the two jobs. Is the Quartz lib the latest version? This problem never appeared to happen under NetBeans 6.9 with an earlier version of Tomcat which I was using recently. The memory leak detection was released in 6.0.24. So the problem might have existed, you just might not have known about it. And I wonder if this may have anything to do with the Tomcat out of memory messages I've been receiving? Do I need to increase the memory allocated to the JVM for Tomcat at all? Some of the detection just results in a log message, some of it results in a message and an attempt to clean up. p -Original Message- From: Pid * [mailto:p...@pidster.com] Sent: 16 Oct 2010 15 06 To: Tomcat Users List Subject: Re: Tomcat memory leak error launching web app in NetBeans 6.9.1 On 16 Oct 2010, at 12:45, Martin O'Shea app...@dsl.pipex.com wrote: Hello I wonder if anyone can help here? I am developing a web application written in Java servlets and JSPs which uses Quartz 1.6.1 to submit two jobs when Apache Tomcat 6.0.26 is started and hourly after that. But what I'm finding is that a message is issued several times as the server is started in NetBeans 6.9.1. The message is: 16-Oct-2010 12:20:18 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads SEVERE: A web application appears to have started a thread named [DefaultQuartzScheduler_Worker-1] but has failed to stop it. This is very likely to create a memory leak. Yes. So, umm, your webapp uses quartz - which is starting threads and not stopping them. Has anyone any idea? It seems to be causing Tomcat to stop every so often requiring a PC reboot. And I've found very little about this so far. The error message is issued by Tomcat when an app is stopped and it finds resources that haven't been properly terminated. The message itself is doesn't cause a leak, the source of the problem might - as the message itself states. I don't know if it is a problem with Tomcat or Quartz so any help is welcome Quartz, or the way you've configured it. p Thanks Martin O'Shea. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org 0x62590808.asc Description: application/pgp-keys signature.asc Description: OpenPGP digital signature
RE: Tomcat memory leak error launching web app in NetBeans 6.9.1
This answers a few questions. I thought also that I had the most recent version of Quartz running but I only have version 1.6.1. They are up to 1.8.3 so I will try this out. Thanks. -Original Message- From: Pid [mailto:p...@pidster.com] Sent: 16 Oct 2010 17 33 To: Tomcat Users List Subject: Re: Tomcat memory leak error launching web app in NetBeans 6.9.1 On 16/10/2010 15:24, Martin O'Shea wrote: OK. So the error is happening as the application is closed, not as it started. My mistake. But Tomcat restarts occur frequently as I have NetBeans's Deploy on Save set. This seems to restart the server with the current objects. But what I don't understand is why the ServletContextListener which handles Quartz jobs should be going wrong? It is set to start and stop Quartz at contextInitialized and contextDestroyed times where the former creates an instance of a SchedulerController class which submits the two jobs. Is the Quartz lib the latest version? This problem never appeared to happen under NetBeans 6.9 with an earlier version of Tomcat which I was using recently. The memory leak detection was released in 6.0.24. So the problem might have existed, you just might not have known about it. And I wonder if this may have anything to do with the Tomcat out of memory messages I've been receiving? Do I need to increase the memory allocated to the JVM for Tomcat at all? Some of the detection just results in a log message, some of it results in a message and an attempt to clean up. p -Original Message- From: Pid * [mailto:p...@pidster.com] Sent: 16 Oct 2010 15 06 To: Tomcat Users List Subject: Re: Tomcat memory leak error launching web app in NetBeans 6.9.1 On 16 Oct 2010, at 12:45, Martin O'Shea app...@dsl.pipex.com wrote: Hello I wonder if anyone can help here? I am developing a web application written in Java servlets and JSPs which uses Quartz 1.6.1 to submit two jobs when Apache Tomcat 6.0.26 is started and hourly after that. But what I'm finding is that a message is issued several times as the server is started in NetBeans 6.9.1. The message is: 16-Oct-2010 12:20:18 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads SEVERE: A web application appears to have started a thread named [DefaultQuartzScheduler_Worker-1] but has failed to stop it. This is very likely to create a memory leak. Yes. So, umm, your webapp uses quartz - which is starting threads and not stopping them. Has anyone any idea? It seems to be causing Tomcat to stop every so often requiring a PC reboot. And I've found very little about this so far. The error message is issued by Tomcat when an app is stopped and it finds resources that haven't been properly terminated. The message itself is doesn't cause a leak, the source of the problem might - as the message itself states. I don't know if it is a problem with Tomcat or Quartz so any help is welcome Quartz, or the way you've configured it. p Thanks Martin O'Shea. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: tomcat memory leak problem
As stated below profiling (Yourkit is a very good recommendation, you can try their early access version http://www.yourkit.com/eap/index.jsp) will give you more insight in your tomcat application. Sometimes changing your memory / garbage collect parameters can change the world for you. For more insight read: http://www.informit.com/guides/content.aspx?g=javaseqNum=253 http://java.sun.com/docs/hotspot/gc5.0/gc_tuning_5.html Hubert -Original Message- From: Piller Sébastien [mailto:pi...@hmcrecord.ch] Sent: 05 February 2009 17:25 To: Tomcat Users List Subject: Re: tomcat memory leak problem Are you sure you don't have any thread or task (I mean, quartz or so) that is running and consume memory? I agree, this sounds quite strange (our app is running for several weeks and don't have any major issue, we sometimes need to restart tomcat because it hangs, but our memory is under control, and we use lotz of external api like spring, hibernate, wicket, etc.) Could you maybe profile it using Yourkit or any other tool? fcxjp a écrit : My system environment is: Windows 2000 Server. JDK 1.5, tomcat 5.5, Oracle 9 The problems are: 1. After tomcat was started, the memory of the tomcat was normal, about 200M-300M. But after a certain time(this time was not set), the memory began to grow, and the growing speed was so fast that in about 5 minites the maximum would be reached. The difference of this problem with other problems I've checked is, in other problems, the memory growing speed is continual and not so fast, while in our problem the memory didn't grow at the beginning, but after a certain time instead. 2. There is another strange phenomenon here. We restarted tomcat at 23:30 last night. We checked the log at 8:00 this morning and found out the system was not used by anyone during this time. But the memory of tomcat had reached to 1.5G, which is the maximun of tomcat's memory. Later, after some users began to use this system, tomcat' memory dropped to 500M+. How and why was the memory collected? By the way, we have cheched the code for any optimization, including StringBuffer, Vector, datasource connections, etc., which only resulted with a faster response speed for users, not any influence for the memory problem. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
tomcat memory leak problem
My system environment is: Windows 2000 Server. JDK 1.5, tomcat 5.5, Oracle 9 The problems are: 1. After tomcat was started, the memory of the tomcat was normal, about 200M-300M. But after a certain time(this time was not set), the memory began to grow, and the growing speed was so fast that in about 5 minites the maximum would be reached. The difference of this problem with other problems I've checked is, in other problems, the memory growing speed is continual and not so fast, while in our problem the memory didn't grow at the beginning, but after a certain time instead. 2. There is another strange phenomenon here. We restarted tomcat at 23:30 last night. We checked the log at 8:00 this morning and found out the system was not used by anyone during this time. But the memory of tomcat had reached to 1.5G, which is the maximun of tomcat's memory. Later, after some users began to use this system, tomcat' memory dropped to 500M+. How and why was the memory collected? By the way, we have cheched the code for any optimization, including StringBuffer, Vector, datasource connections, etc., which only resulted with a faster response speed for users, not any influence for the memory problem. -- View this message in context: http://www.nabble.com/tomcat-memory-leak-problem-tp21855110p21855110.html Sent from the Tomcat - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: tomcat memory leak problem
Are you sure you don't have any thread or task (I mean, quartz or so) that is running and consume memory? I agree, this sounds quite strange (our app is running for several weeks and don't have any major issue, we sometimes need to restart tomcat because it hangs, but our memory is under control, and we use lotz of external api like spring, hibernate, wicket, etc.) Could you maybe profile it using Yourkit or any other tool? fcxjp a écrit : My system environment is: Windows 2000 Server. JDK 1.5, tomcat 5.5, Oracle 9 The problems are: 1. After tomcat was started, the memory of the tomcat was normal, about 200M-300M. But after a certain time(this time was not set), the memory began to grow, and the growing speed was so fast that in about 5 minites the maximum would be reached. The difference of this problem with other problems I've checked is, in other problems, the memory growing speed is continual and not so fast, while in our problem the memory didn't grow at the beginning, but after a certain time instead. 2. There is another strange phenomenon here. We restarted tomcat at 23:30 last night. We checked the log at 8:00 this morning and found out the system was not used by anyone during this time. But the memory of tomcat had reached to 1.5G, which is the maximun of tomcat's memory. Later, after some users began to use this system, tomcat' memory dropped to 500M+. How and why was the memory collected? By the way, we have cheched the code for any optimization, including StringBuffer, Vector, datasource connections, etc., which only resulted with a faster response speed for users, not any influence for the memory problem. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: tomcat memory leak problem
The problem may be in your web application and not in Tomcat itself. Duplicate your environment and use a memory profiler. (like the one included with Netbeans) Or use the extended JVM options to produce a HeapDump -Original Message- From: fcxjp [mailto:fc...@163.com] Sent: Thursday, February 05, 2009 11:14 AM To: users@tomcat.apache.org Subject: tomcat memory leak problem My system environment is: Windows 2000 Server. JDK 1.5, tomcat 5.5, Oracle 9 The problems are: 1. After tomcat was started, the memory of the tomcat was normal, about 200M-300M. But after a certain time(this time was not set), the memory began to grow, and the growing speed was so fast that in about 5 minites the maximum would be reached. The difference of this problem with other problems I've checked is, in other problems, the memory growing speed is continual and not so fast, while in our problem the memory didn't grow at the beginning, but after a certain time instead. 2. There is another strange phenomenon here. We restarted tomcat at 23:30 last night. We checked the log at 8:00 this morning and found out the system was not used by anyone during this time. But the memory of tomcat had reached to 1.5G, which is the maximun of tomcat's memory. Later, after some users began to use this system, tomcat' memory dropped to 500M+. How and why was the memory collected? By the way, we have cheched the code for any optimization, including StringBuffer, Vector, datasource connections, etc., which only resulted with a faster response speed for users, not any influence for the memory problem. -- View this message in context: http://www.nabble.com/tomcat-memory-leak-problem-tp21855110p21855110.htm l Sent from the Tomcat - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Any application which is use to detect tomcat memory leak problem
Hi Gurus, Is there any application which I may use to detect tomcat memory leak problem? Thank you in advance for any value input. Thanks Regards. Get your new Email address! Grab the Email name you#39;ve always wanted before someone else does! http://mail.promotions.yahoo.com/newdomains/sg/ - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Any application which is use to detect tomcat memory leak problem
Hello Nix Are you looking for a memory leak in your web application or in tomcat? Short answer is it's not easy. The garbage collection mechanism in the JVM will cleanup any objects that are no longer referenced. Therefore, you are only concerned with objects that remain referenced (which in an ideal world should be relatively few). To test if your app is indeed exponentially increasing, you could start the JVM with the -Xverbose:gc option and watch the output for a while. If not, a good (commercial) tool is JProbe http://www.quest.com/jprobe/memory-home.aspx Regards Tom On 23/06/2008, at 12:17 PM, Nix Hanwei wrote: Hi Gurus, Is there any application which I may use to detect tomcat memory leak problem? Thank you in advance for any value input. Thanks Regards. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Any application which is use to detect tomcat memory leak problem
One of the things I had done in my past projects was to run a thread which periodically executes the freeMemory /totalMemory methods on Runtime class in JVM, this will at least tell you how the memory is utilised, but pinpointing the leak may need a commercial tool. -Sameer --- On Mon, 6/23/08, Nix Hanwei [EMAIL PROTECTED] wrote: From: Nix Hanwei [EMAIL PROTECTED] Subject: Any application which is use to detect tomcat memory leak problem To: Tomcat Users List users@tomcat.apache.org Date: Monday, June 23, 2008, 9:47 AM Hi Gurus, Is there any application which I may use to detect tomcat memory leak problem? Thank you in advance for any value input. Thanks Regards. Get your new Email address! Grab the Email name you#39;ve always wanted before someone else does! http://mail.promotions.yahoo.com/newdomains/sg/ - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat memory leak?
Hi guys, Indeed session disabling did the job. Thanks! - Original Message - From: Christopher Schultz [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Thursday, January 24, 2008 9:26 PM Subject: Re: Tomcat memory leak? -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ofer, Ofer Kalisky wrote: | That's what I'm saying, I've been sitting on this for two days and can't | figure it out. Does your JSP disable sessions? It's possible that your python script is creating millions of (unused) sessions that don't expire before you bust your heap. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.8 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkeY5k0ACgkQ9CaO5/Lv0PAW9ACeK3nEkRrl3t9gwhu91S28UmnO aMYAoL824Fsk3pmuYWBPIORO54WqnuDG =5J03 -END PGP SIGNATURE- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Information from ESET NOD32 Antivirus, version of virus signature database 2824 (20080126) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tomcat memory leak?
Hi, I know it's weird, but I'm doing the simplest thing and can't believe there such a leak that I'm the first one to notice. I bet it's my bad, please someone explain, what I'm doing wrong... I created the simplest JSP and when I load test it - tomcat (6.0.14, jre1.6.0_03) goes to 99.9% memory use in a few minutes (If I raise the max heap size it takes longer, but it happens several minutes afterwards), and when I stop bombarding it, it doesn't return to the usual percentage. When I try the same with an HTML instead of a JSP, that returns exactly the same - it stays on 12%-20%, cleans with the garbage collector, and returns to the usual percentage (about 12%). I tried profiling with several plugins and external programs, but I really can't understand what's going on. They tell me that most of the allocated bytes are char[], but I'm not sure who's the allocator and if there's anything I can do about it... Attached are: 1. a test in python that bombards the tomcat, 2. a war with both something.jsp and something.html (they are both the same, but when I bombard something.html everything is ok, and when I do the same for something.jsp - the problem occurs) Can anyone tell me what I'm doing wrong? does it happen to you too? Thanks, Ofer. http://www.nabble.com/file/p15065013/LoadTest.war LoadTest.war http://www.nabble.com/file/p15065013/load.py load.py -- View this message in context: http://www.nabble.com/Tomcat-memory-leak--tp15065013p15065013.html Sent from the Tomcat - User mailing list archive at Nabble.com. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat memory leak?
I think one of the files wasn't attached for some reason... - Original Message - From: Ofer Kalisky To: users@tomcat.apache.org Sent: Thursday, January 24, 2008 4:51 PM Subject: Tomcat memory leak? Hi, I know it's weird, but I'm doing the simplest thing and can't believe there such a leak that I'm the first one to notice. I bet it's my bad, please someone explain, what I'm doing wrong... I created the simplest JSP and when I load test it - tomcat (6.0.14, jre1.6.0_03) goes to 99.9% memory use in a few minutes (If I raise the max heap size it takes longer, but it happens several minutes afterwards), and when I stop bombarding it, it doesn't return to the usual percentage. When I try the same with an HTML instead of a JSP, that returns exactly the same - it stays on 12%-20%, cleans with the garbage collector, and returns to the usual percentage (about 12%). I tried profiling with several plugins and external programs, but I really can't understand what's going on. They tell me that most of the allocated bytes are char[], but I'm not sure who's the allocator and if there's anything I can do about it... Attached are: 1. a test in python that bombards the tomcat, 2. a war with both something.jsp and something.html (they are both the same, but when I bombard something.html everything is ok, and when I do the same for something.jsp - the problem occurs) Can anyone tell me what I'm doing wrong? does it happen to you too? Thanks, Ofer. -- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat memory leak?
Good Morning Ofer I dont see attachement of /LoadTest/something.jsp Martin- - Original Message - Wrom: FPEGAUTFJMVRESK To: users@tomcat.apache.org Sent: Thursday, January 24, 2008 9:51 AM Subject: Tomcat memory leak? Hi, I know it's weird, but I'm doing the simplest thing and can't believe there such a leak that I'm the first one to notice. I bet it's my bad, please someone explain, what I'm doing wrong... I created the simplest JSP and when I load test it - tomcat (6.0.14, jre1.6.0_03) goes to 99.9% memory use in a few minutes (If I raise the max heap size it takes longer, but it happens several minutes afterwards), and when I stop bombarding it, it doesn't return to the usual percentage. When I try the same with an HTML instead of a JSP, that returns exactly the same - it stays on 12%-20%, cleans with the garbage collector, and returns to the usual percentage (about 12%). I tried profiling with several plugins and external programs, but I really can't understand what's going on. They tell me that most of the allocated bytes are char[], but I'm not sure who's the allocator and if there's anything I can do about it... Attached are: 1. a test in python that bombards the tomcat, 2. a war with both something.jsp and something.html (they are both the same, but when I bombard something.html everything is ok, and when I do the same for something.jsp - the problem occurs) Can anyone tell me what I'm doing wrong? does it happen to you too? Thanks, Ofer. -- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat memory leak?
Change file ext to zip... - Original Message - From: Ofer Kalisky [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Thursday, January 24, 2008 5:08 PM Subject: Re: Tomcat memory leak? I think the mailing list blocks war files... trying with zip... - Original Message - From: [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Thursday, January 24, 2008 5:00 PM Subject: Re: Tomcat memory leak? Good Morning Ofer I dont see attachement of /LoadTest/something.jsp Martin- - Original Message - Wrom: FPEGAUTFJMVRESK To: users@tomcat.apache.org Sent: Thursday, January 24, 2008 9:51 AM Subject: Tomcat memory leak? Hi, I know it's weird, but I'm doing the simplest thing and can't believe there such a leak that I'm the first one to notice. I bet it's my bad, please someone explain, what I'm doing wrong... I created the simplest JSP and when I load test it - tomcat (6.0.14, jre1.6.0_03) goes to 99.9% memory use in a few minutes (If I raise the max heap size it takes longer, but it happens several minutes afterwards), and when I stop bombarding it, it doesn't return to the usual percentage. When I try the same with an HTML instead of a JSP, that returns exactly the same - it stays on 12%-20%, cleans with the garbage collector, and returns to the usual percentage (about 12%). I tried profiling with several plugins and external programs, but I really can't understand what's going on. They tell me that most of the allocated bytes are char[], but I'm not sure who's the allocator and if there's anything I can do about it... Attached are: 1. a test in python that bombards the tomcat, 2. a war with both something.jsp and something.html (they are both the same, but when I bombard something.html everything is ok, and when I do the same for something.jsp - the problem occurs) Can anyone tell me what I'm doing wrong? does it happen to you too? Thanks, Ofer. -- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] PK á88Òðl¨ Û load.py5Á [EMAIL PROTECTED] þÃc P ®jÑ¢ ?`6éqÞ4ó¢ßo4Û{÷âdÉ1ÌVã-¡Äµ²Nâ¨'c\;ù¹m¯TÏHúNä¹®d%E¶¹S¯·òÓ±;Å º{HáiR¢ò§·àÊ0°Xb§¼%ãU:'øa{)¡ ϲùQdó l¡üÏö~êPK ¯88I^9 . LoadTest.warðffaà Âu[EMAIL PROTECTED]Ý\Cô|Ýû9íã«w×[WëÜó®?xZtÎSGï¯ÎÉ A[EMAIL PROTECTED] wuÛ¤Ï[EMAIL PROTECTED](@Õˤ·5I¯7§wB¼÷a£óEÿð©¾÷ܵ]óeBSÀü9/nµÛTÕ÷pÞ¶kùùVf[¶åO/®û~_ðô:³ßVHÏ(Ùíɲ-cʶÝ={ÖɽÔË[çÊ-5·{Ë©Ò9ïæFÛÛNx®å¬§HZä{½-×? 4²31åÛ~b5Ë3Ke_éo˾voSÚþÇ2çü.þ4%À{nUf÷îÒ.uÃ|®þÙîa®Êvöû·ú]+¾¶PéáUí VÊö+¦~qºç±éKÓÿ2'µ]WÙV\|Q]ª¡¿%ôÂÆK×Ý4~ä·¸æBï$®mþla®;[EMAIL PROTECTED] ¨áÇÄÅù¹©%yéz%¹9Oj»ññÓM§üW²\Ìü麫ó¤êÌÛ¼ÎIvV¾\yîgeæÌUGY½Dõú¸ÌfV².UåRʺrêJQU/®ÊÎ e^íë4Ñ.`ãòõ«ÕævZ.uècj9iæìYGõãùû{]WÉ:se¥*¯FV·÷äcÇI µ¾àQÿõ #8IÈO³t0;#²øÐ/²Ð9'R^$%wÁr}è9R I_rNbqqj1VýLâ9·0 l ² 07ÀLçAÑÍZF ëù9µó£è\ÎQB keäXàCÑü={ ë¥d½¼(zw1¡¥Ct7Á|Ë¢µ)[EMAIL PROTECTED]|A+¢ë/3fdx³²AÌç`¸ ô-H PK á88Òðl¨ Û load.pyPK ¯88I^9 . Í LoadTest.warPK o - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat memory leak?
Ok, since sending an attachment doesn't work, simply create a webapp by the name of LoadTest and create two files inside: something.jsp and something.html the content of both files should be: htmlbody//html try the load.py with both: import httplib i = 0 while 1: conn = httplib.HTTPConnection(localhost:8080) conn.request(GET, /LoadTest/something.jsp) r1 = conn.getresponse() if (i % 500 == 0): print i i = i + 1 conn.close() sorry for any inconvenience Ofer. - Original Message - From: Ofer Kalisky [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Thursday, January 24, 2008 5:08 PM Subject: Re: Tomcat memory leak? I think the mailing list blocks war files... trying with zip... - Original Message - From: [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Thursday, January 24, 2008 5:00 PM Subject: Re: Tomcat memory leak? Good Morning Ofer I dont see attachement of /LoadTest/something.jsp Martin- - Original Message - Wrom: FPEGAUTFJMVRESK To: users@tomcat.apache.org Sent: Thursday, January 24, 2008 9:51 AM Subject: Tomcat memory leak? Hi, I know it's weird, but I'm doing the simplest thing and can't believe there such a leak that I'm the first one to notice. I bet it's my bad, please someone explain, what I'm doing wrong... I created the simplest JSP and when I load test it - tomcat (6.0.14, jre1.6.0_03) goes to 99.9% memory use in a few minutes (If I raise the max heap size it takes longer, but it happens several minutes afterwards), and when I stop bombarding it, it doesn't return to the usual percentage. When I try the same with an HTML instead of a JSP, that returns exactly the same - it stays on 12%-20%, cleans with the garbage collector, and returns to the usual percentage (about 12%). I tried profiling with several plugins and external programs, but I really can't understand what's going on. They tell me that most of the allocated bytes are char[], but I'm not sure who's the allocator and if there's anything I can do about it... Attached are: 1. a test in python that bombards the tomcat, 2. a war with both something.jsp and something.html (they are both the same, but when I bombard something.html everything is ok, and when I do the same for something.jsp - the problem occurs) Can anyone tell me what I'm doing wrong? does it happen to you too? Thanks, Ofer. -- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat memory leak?
I downloaded your example. So you are telling us, that simply calling a JSP file with html markup only and without any code kills your tomcat? Regards Leon On Jan 24, 2008 4:19 PM, Ofer Kalisky [EMAIL PROTECTED] wrote: Ok, since sending an attachment doesn't work, simply create a webapp by the name of LoadTest and create two files inside: something.jsp and something.html the content of both files should be: htmlbody//html try the load.py with both: import httplib i = 0 while 1: conn = httplib.HTTPConnection(localhost:8080) conn.request(GET, /LoadTest/something.jsp) r1 = conn.getresponse() if (i % 500 == 0): print i i = i + 1 conn.close() sorry for any inconvenience Ofer. - Original Message - From: Ofer Kalisky [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Thursday, January 24, 2008 5:08 PM Subject: Re: Tomcat memory leak? I think the mailing list blocks war files... trying with zip... - Original Message - From: [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Thursday, January 24, 2008 5:00 PM Subject: Re: Tomcat memory leak? Good Morning Ofer I dont see attachement of /LoadTest/something.jsp Martin- - Original Message - Wrom: FPEGAUTFJMVRESK To: users@tomcat.apache.org Sent: Thursday, January 24, 2008 9:51 AM Subject: Tomcat memory leak? Hi, I know it's weird, but I'm doing the simplest thing and can't believe there such a leak that I'm the first one to notice. I bet it's my bad, please someone explain, what I'm doing wrong... I created the simplest JSP and when I load test it - tomcat (6.0.14, jre1.6.0_03) goes to 99.9% memory use in a few minutes (If I raise the max heap size it takes longer, but it happens several minutes afterwards), and when I stop bombarding it, it doesn't return to the usual percentage. When I try the same with an HTML instead of a JSP, that returns exactly the same - it stays on 12%-20%, cleans with the garbage collector, and returns to the usual percentage (about 12%). I tried profiling with several plugins and external programs, but I really can't understand what's going on. They tell me that most of the allocated bytes are char[], but I'm not sure who's the allocator and if there's anything I can do about it... Attached are: 1. a test in python that bombards the tomcat, 2. a war with both something.jsp and something.html (they are both the same, but when I bombard something.html everything is ok, and when I do the same for something.jsp - the problem occurs) Can anyone tell me what I'm doing wrong? does it happen to you too? Thanks, Ofer. -- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat memory leak?
That's what I'm saying, I've been sitting on this for two days and can't figure it out. Do you mean to say that you tried it and even when accessing the JSP with the script - your memory stays low? What am I doing wrong then? Please notice the tomcat version and the JRE version I stated (6.0.14, jre1.6.0_03). One more thing: as I said, I'm trying it with 64M of max heap space, but I figured, if it goes to 99.9% mem use, there's no use raising it (even though I tried and it reached 99.9% after a short while) Ofer. - Original Message - From: Leon Rosenberg [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Thursday, January 24, 2008 5:25 PM Subject: Re: Tomcat memory leak? I downloaded your example. So you are telling us, that simply calling a JSP file with html markup only and without any code kills your tomcat? Regards Leon On Jan 24, 2008 4:19 PM, Ofer Kalisky [EMAIL PROTECTED] wrote: Ok, since sending an attachment doesn't work, simply create a webapp by the name of LoadTest and create two files inside: something.jsp and something.html the content of both files should be: htmlbody//html try the load.py with both: import httplib i = 0 while 1: conn = httplib.HTTPConnection(localhost:8080) conn.request(GET, /LoadTest/something.jsp) r1 = conn.getresponse() if (i % 500 == 0): print i i = i + 1 conn.close() sorry for any inconvenience Ofer. - Original Message - From: Ofer Kalisky [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Thursday, January 24, 2008 5:08 PM Subject: Re: Tomcat memory leak? I think the mailing list blocks war files... trying with zip... - Original Message - From: [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Thursday, January 24, 2008 5:00 PM Subject: Re: Tomcat memory leak? Good Morning Ofer I dont see attachement of /LoadTest/something.jsp Martin- - Original Message - Wrom: FPEGAUTFJMVRESK To: users@tomcat.apache.org Sent: Thursday, January 24, 2008 9:51 AM Subject: Tomcat memory leak? Hi, I know it's weird, but I'm doing the simplest thing and can't believe there such a leak that I'm the first one to notice. I bet it's my bad, please someone explain, what I'm doing wrong... I created the simplest JSP and when I load test it - tomcat (6.0.14, jre1.6.0_03) goes to 99.9% memory use in a few minutes (If I raise the max heap size it takes longer, but it happens several minutes afterwards), and when I stop bombarding it, it doesn't return to the usual percentage. When I try the same with an HTML instead of a JSP, that returns exactly the same - it stays on 12%-20%, cleans with the garbage collector, and returns to the usual percentage (about 12%). I tried profiling with several plugins and external programs, but I really can't understand what's going on. They tell me that most of the allocated bytes are char[], but I'm not sure who's the allocator and if there's anything I can do about it... Attached are: 1. a test in python that bombards the tomcat, 2. a war with both something.jsp and something.html (they are both the same, but when I bombard something.html everything is ok, and when I do the same for something.jsp - the problem occurs) Can anyone tell me what I'm doing wrong? does it happen to you too? Thanks, Ofer. -- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat memory leak?
i downloaded the war file and put it info webapps (it was the only webapp ) started tomcat (5.5.17) started following in another shell: while true; do wget http://localhost:8080/LoadTest/something.jsp; ; done canceled after some thousands of iterations i checked the memory usage via activity monitor (macosx) and tomcat manager app. Both showed no changes. Could it be that your python lib is keeping connection or something? Have you checked via tomcat maanager how many connections you actually have? regards Leon On Jan 24, 2008 4:31 PM, Ofer Kalisky [EMAIL PROTECTED] wrote: That's what I'm saying, I've been sitting on this for two days and can't figure it out. Do you mean to say that you tried it and even when accessing the JSP with the script - your memory stays low? What am I doing wrong then? Please notice the tomcat version and the JRE version I stated (6.0.14, jre1.6.0_03). One more thing: as I said, I'm trying it with 64M of max heap space, but I figured, if it goes to 99.9% mem use, there's no use raising it (even though I tried and it reached 99.9% after a short while) Ofer. - Original Message - From: Leon Rosenberg [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Thursday, January 24, 2008 5:25 PM Subject: Re: Tomcat memory leak? I downloaded your example. So you are telling us, that simply calling a JSP file with html markup only and without any code kills your tomcat? Regards Leon On Jan 24, 2008 4:19 PM, Ofer Kalisky [EMAIL PROTECTED] wrote: Ok, since sending an attachment doesn't work, simply create a webapp by the name of LoadTest and create two files inside: something.jsp and something.html the content of both files should be: htmlbody//html try the load.py with both: import httplib i = 0 while 1: conn = httplib.HTTPConnection(localhost:8080) conn.request(GET, /LoadTest/something.jsp) r1 = conn.getresponse() if (i % 500 == 0): print i i = i + 1 conn.close() sorry for any inconvenience Ofer. - Original Message - From: Ofer Kalisky [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Thursday, January 24, 2008 5:08 PM Subject: Re: Tomcat memory leak? I think the mailing list blocks war files... trying with zip... - Original Message - From: [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Thursday, January 24, 2008 5:00 PM Subject: Re: Tomcat memory leak? Good Morning Ofer I dont see attachement of /LoadTest/something.jsp Martin- - Original Message - Wrom: FPEGAUTFJMVRESK To: users@tomcat.apache.org Sent: Thursday, January 24, 2008 9:51 AM Subject: Tomcat memory leak? Hi, I know it's weird, but I'm doing the simplest thing and can't believe there such a leak that I'm the first one to notice. I bet it's my bad, please someone explain, what I'm doing wrong... I created the simplest JSP and when I load test it - tomcat (6.0.14, jre1.6.0_03) goes to 99.9% memory use in a few minutes (If I raise the max heap size it takes longer, but it happens several minutes afterwards), and when I stop bombarding it, it doesn't return to the usual percentage. When I try the same with an HTML instead of a JSP, that returns exactly the same - it stays on 12%-20%, cleans with the garbage collector, and returns to the usual percentage (about 12%). I tried profiling with several plugins and external programs, but I really can't understand what's going on. They tell me that most of the allocated bytes are char[], but I'm not sure who's the allocator and if there's anything I can do about it... Attached are: 1. a test in python that bombards the tomcat, 2. a war with both something.jsp and something.html (they are both the same, but when I bombard something.html everything is ok, and when I do the same for something.jsp - the problem occurs) Can anyone tell me what I'm doing wrong? does it happen to you too? Thanks, Ofer. -- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL
Re: Tomcat memory leak?
you need to modify web.xml to point to your jsp file e.g. welcome-filesomething.jsp/welcome-file we can help you with your action class ChangeConfig.jsp when you get around sending us that class attached is a picture of jconsole memory profiler run while loading and init'ing something.jsp notice the jump to 75% on the initial load but then settling to 30% after the load which took no more than 1 second Take a look at this article on non-multi-threaded python applications vs Java Web applications performance tests http://mrpointy.wordpress.com/2007/11/06/java-vs-python-performance/ conclusions are that unless you're doing ALOT of I/O (printing) or Interpteter initialisation performance will increase significantly when using Java over Python Martin-- - Original Message - From: Ofer Kalisky [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Thursday, January 24, 2008 10:31 AM Subject: Re: Tomcat memory leak? That's what I'm saying, I've been sitting on this for two days and can't figure it out. Do you mean to say that you tried it and even when accessing the JSP with the script - your memory stays low? What am I doing wrong then? Please notice the tomcat version and the JRE version I stated (6.0.14, jre1.6.0_03). One more thing: as I said, I'm trying it with 64M of max heap space, but I figured, if it goes to 99.9% mem use, there's no use raising it (even though I tried and it reached 99.9% after a short while) Ofer. - Original Message - From: Leon Rosenberg [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Thursday, January 24, 2008 5:25 PM Subject: Re: Tomcat memory leak? I downloaded your example. So you are telling us, that simply calling a JSP file with html markup only and without any code kills your tomcat? Regards Leon On Jan 24, 2008 4:19 PM, Ofer Kalisky [EMAIL PROTECTED] wrote: Ok, since sending an attachment doesn't work, simply create a webapp by the name of LoadTest and create two files inside: something.jsp and something.html the content of both files should be: htmlbody//html try the load.py with both: import httplib i = 0 while 1: conn = httplib.HTTPConnection(localhost:8080) conn.request(GET, /LoadTest/something.jsp) r1 = conn.getresponse() if (i % 500 == 0): print i i = i + 1 conn.close() sorry for any inconvenience Ofer. - Original Message - From: Ofer Kalisky [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Thursday, January 24, 2008 5:08 PM Subject: Re: Tomcat memory leak? I think the mailing list blocks war files... trying with zip... - Original Message - From: [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Thursday, January 24, 2008 5:00 PM Subject: Re: Tomcat memory leak? Good Morning Ofer I dont see attachement of /LoadTest/something.jsp Martin- - Original Message - Wrom: FPEGAUTFJMVRESK To: users@tomcat.apache.org Sent: Thursday, January 24, 2008 9:51 AM Subject: Tomcat memory leak? Hi, I know it's weird, but I'm doing the simplest thing and can't believe there such a leak that I'm the first one to notice. I bet it's my bad, please someone explain, what I'm doing wrong... I created the simplest JSP and when I load test it - tomcat (6.0.14, jre1.6.0_03) goes to 99.9% memory use in a few minutes (If I raise the max heap size it takes longer, but it happens several minutes afterwards), and when I stop bombarding it, it doesn't return to the usual percentage. When I try the same with an HTML instead of a JSP, that returns exactly the same - it stays on 12%-20%, cleans with the garbage collector, and returns to the usual percentage (about 12%). I tried profiling with several plugins and external programs, but I really can't understand what's going on. They tell me that most of the allocated bytes are char[], but I'm not sure who's the allocator and if there's anything I can do about it... Attached are: 1. a test in python that bombards the tomcat, 2. a war with both something.jsp and something.html (they are both the same, but when I bombard something.html everything is ok, and when I do the same for something.jsp - the problem occurs) Can anyone tell me what I'm doing wrong? does it happen to you too? Thanks, Ofer. -- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED
Re: Tomcat memory leak?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ofer, Ofer Kalisky wrote: | That's what I'm saying, I've been sitting on this for two days and can't | figure it out. Does your JSP disable sessions? It's possible that your python script is creating millions of (unused) sessions that don't expire before you bust your heap. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.8 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkeY5k0ACgkQ9CaO5/Lv0PAW9ACeK3nEkRrl3t9gwhu91S28UmnO aMYAoL824Fsk3pmuYWBPIORO54WqnuDG =5J03 -END PGP SIGNATURE- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat Memory Leak
El Jueves 25 Mayo 2006 07:44, Bill Barker escribió: If you are using the AJP/1.3 Connector, then 5.0.19 has a very very very very well known memory leak. You need to set request.registerRequests=false in this case. Either that, or upgrade :). hello, I have a similar problem, and similar structure aplication too (MVC). I use DAOs for data access and a Oracle database, jakarta-struts and JSP with JSTL tags for the view layer. I use some profilers, and I obtain similar results. I realized that the char[] and byte[] variables are config and validation struts files and jsp page too. I don't know in what configuration file I have to activate this property: request.registerRequests=false , in jk.properties? server.xml? Is there another ajp version that I can use with ssl? I'm using jakarta-tomcat 50.19 too. The lastest version is 5.5, but I'm not sure that all memory leaks problems had been solved in it. What is your opinion for solved this problem? upgrade to 5.5 or upgrade to 5.0.28 or? For your information, I use Suse Linux Enterprise Server 9 and I install tomcat rpms included in this distritution: $ rpm -qa | grep -i tomcat jakarta-tomcat-5.0.19-29.1 jakarta-tomcat-doc-5.0.19-29.1 apache2-jakarta-tomcat-connectors-5.0.19-29.1 jakarta-tomcat-examples-5.0.19-29.1 $ Thanks and regards, Rocío - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat Memory Leak
Petkov, Rossen ha scritto: Hello, I am having a problem with Tomcat 5.0.19 on windows with JDK 1.4.2_03.The memory that java.exe is using keeps growing till the point that tomcat Runs out of memory. Try this: http://wiki.apache.org/tomcat/OutOfMemory Ciao Antonio - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat Memory Leak
--- Rocio Alfonso Pita [EMAIL PROTECTED] wrote: El Jueves 25 Mayo 2006 18:51, Petkov, Rossen escribi�: The request.registerRequests=false setting goes in the workers.properties file. I already have that an it's not helping with the memory leak. I plan to upgrade Tomcat to 5.0.28 and java to 1.4.2_11 Rossen I have a development pc with tomcat 5.0.28 and java 1.4.2_04 and I obtain out of memory too. I'm sure it's a different case. If you would like to ask a question it would be polite not to hijack someone elses thread. Please create your own email to the list with a specific subject and message/question. Thanks, Wade - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tomcat Memory Leak
Hello, I am having a problem with Tomcat 5.0.19 on windows with JDK 1.4.2_03.The memory that java.exe is using keeps growing till the point that tomcat Runs out of memory. Using a profiler, doesn't seem to help me much. I can see the memory being used by certain classes go up (mainly char[] and byte[] and some tomcat classes, please see the tables below) and even reach all the way to the point that used java heap equals to the java heap, then GC probably kicks but, while running Tomcat throws an OutOfMemory exception. I have allocated -Xmx896M. I'm now forcing a GC when the free memory drops to 15%. With every GC, the freed memory is less and less, which to me is an indication of memory leak. I can't figure out where all those char[] objects are coming from or why they aren't being reclaimed by the garbage collector. I know that something is holding memory and isn't letting it go, and I know that the leaked memory consists of char[] and byte[] objects (see below tables). What I can't figure out is how to determine what's doing the leaking. After several hours of heavy usage, the GC runs and frees less memory than the previous run. This gives me on day of normal operation and I have to restart Tomcat after hours to be ready for the next day, not a really acceptable solution. I noticed the 3 tomcat classes: org.apache.tomcat.util.buf.MessageBytes, org.apache.tomcat.util.buf.ByteChunk and org.apache.tomcat.util.buf.CharChunk. The memory occupied my these seems to never be released. Can they be the cause of the multiple byte[] and char[]? Some info about the application/environment: - Tomcat 5.0.19 on windows with JDK 1.4.2_03. - MVC type web application - front Controller dispathing requests to business classes and forwards to appropriate JSP, passing necessary data objects in the request object - heavy JDBC use and DAO/DTO components, mainly using PreparedStatement - Oracle stored procedures and functions acccessed thru CallableStatement - Oracle database I am doing the usual for closing all jdbc database related objects like ResultSet, PreparedStatement and connections. Here are some thoughts that I have, that could be the reason for the leak, these are more questions: 1. DTO objects are being passed from the data layer to the business layer and finnaly to the JSP. After using the DTOs on the JSP, they are not explicitly set to null in the JSP. I see that all DTO declarations are in the service method of the compiled JSPs. Can this be a problem? 2. HashMaps, HashTables and LinkedHashMaps are being passed the same way thru the layers and end up in the JSPs. These are not set to null either. Can this be a problem? 3. PreparedStatement and CallableStatement are always closed, but not always set to null. Can any of these be the cause? Below are some metrics from my environemnt: After a several hours of heavy usage, BEFORE GC: Name Instance countSize char[ ]2,200,184 425,721 kB byte[ ]199,003 178,902 kB java.lang.String 1,825,003 42,773 kB java.lang.StringBuffer 925,351 21,687 kB class[ ] 679,935 19,181 kB org.apache.naming.resources.FileDirContext$FileResourceAttributes 122,254 8,595 kB org.apache.tomcat.util.buf.MessageBytes117,876 5,525 kB org.apache.tomcat.util.buf.ByteChunk 135,061 5,275 kB org.apache.tomcat.util.buf.CharChunk 132,558 5,178 kB java.util.HashMap$ValueIterator97,5513,04 ...more AFTER GC: This is the top of the list, sorted by size: Name Instance countSize byte[ ]47,866167,877 kB char[ ]69,387151,906 kB org.apache.tomcat.util.buf.MessageBytes117,928 5,527 kB org.apache.tomcat.util.buf.ByteChunk 135,120 5,278 kB org.apache.tomcat.util.buf.CharChunk 132,616 5,180 kB class[ ] 71,5504,711 kB int[ ] 22,1951,408 kB java.text.DecimalFormat7,351 804 kB java.lang.String 32,828769 kB org.apache.tomcat.util.http.MimeHeaderField28,098658 kB java.util.HashMap 15,598609 kB java.util.GregorianCalendar7,351 516 kB long[ ]4,927 498 kB java.text.DecimalFormatSymbols 7,351 402 kB ...more As you can see,
Re: Tomcat Memory Leak
I had a leak of that kind when I wasn't closing inputstream and outputstream objects. It's one thing to check anyway. Petkov, Rossen wrote: ... Using a profiler, doesn't seem to help me much. I can see the memory being used by certain classes go up (mainly char[] and byte[] and some tomcat classes, please see the tables below) and even reach all the way to the point that used java heap equals to the java heap, then GC probably kicks but, while running Tomcat throws an OutOfMemory exception. I have allocated -Xmx896M. I'm now forcing a GC when the free memory drops to 15%. With every GC, the freed memory is less and less, which to me is an indication of memory leak. ... - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat Memory Leak
--- Petkov, Rossen [EMAIL PROTECTED] wrote: Hello, I am having a problem with Tomcat 5.0.19 on windows with JDK 1.4.2_03.The memory that java.exe is using keeps growing till the point that tomcat Runs out of memory. Using a profiler, doesn't seem to help me much. I can see the memory being used by certain classes go up (mainly char[] and byte[] and some tomcat classes, please see the tables below) and even reach all the way to the point that used java heap equals to the java heap, then GC probably kicks but, while running Tomcat throws an OutOfMemory exception. I have allocated -Xmx896M. I'm now forcing a GC when the free memory drops to 15%. With every GC, the freed memory is less and less, which to me is an indication of memory leak. I can't figure out where all those char[] objects are coming from or why they aren't being reclaimed by the garbage collector. I know that something is holding memory and isn't letting it go, and I know that the leaked memory consists of char[] and byte[] objects (see below tables). What I can't figure out is how to determine what's doing the leaking. After several hours of heavy usage, the GC runs and frees less memory than the previous run. This gives me on day of normal operation and I have to restart Tomcat after hours to be ready for the next day, not a really acceptable solution. I noticed the 3 tomcat classes: org.apache.tomcat.util.buf.MessageBytes, org.apache.tomcat.util.buf.ByteChunk and org.apache.tomcat.util.buf.CharChunk. The memory occupied my these seems to never be released. Can they be the cause of the multiple byte[] and char[]? Some info about the application/environment: - Tomcat 5.0.19 on windows with JDK 1.4.2_03. - MVC type web application - front Controller dispathing requests to business classes and forwards to appropriate JSP, passing necessary data objects in the request object - heavy JDBC use and DAO/DTO components, mainly using PreparedStatement - Oracle stored procedures and functions acccessed thru CallableStatement - Oracle database I am doing the usual for closing all jdbc database related objects like ResultSet, PreparedStatement and connections. Here are some thoughts that I have, that could be the reason for the leak, these are more questions: 1. DTO objects are being passed from the data layer to the business layer and finnaly to the JSP. After using the DTOs on the JSP, they are not explicitly set to null in the JSP. I see that all DTO declarations are in the service method of the compiled JSPs. Can this be a problem? 2. HashMaps, HashTables and LinkedHashMaps are being passed the same way thru the layers and end up in the JSPs. These are not set to null either. Can this be a problem? 3. PreparedStatement and CallableStatement are always closed, but not always set to null. Can any of these be the cause? Below are some metrics from my environemnt: After a several hours of heavy usage, BEFORE GC: Name Instance countSize char[ ] 2,200,184 425,721 kB byte[ ] 199,003 178,902 kB java.lang.String 1,825,003 42,773 kB java.lang.StringBuffer 925,351 21,687 kB class[ ] 679,935 19,181 kB org.apache.naming.resources.FileDirContext$FileResourceAttributes 122,254 8,595 kB org.apache.tomcat.util.buf.MessageBytes 117,876 5,525 kB org.apache.tomcat.util.buf.ByteChunk 135,061 5,275 kB org.apache.tomcat.util.buf.CharChunk 132,558 5,178 kB java.util.HashMap$ValueIterator 97,5513,04 ...more AFTER GC: This is the top of the list, sorted by size: Name Instance countSize byte[ ] 47,866167,877 kB char[ ] 69,387151,906 kB org.apache.tomcat.util.buf.MessageBytes 117,928 5,527 kB org.apache.tomcat.util.buf.ByteChunk 135,120 5,278 kB org.apache.tomcat.util.buf.CharChunk 132,616 5,180 kB class[ ] 71,5504,711 kB int[ ] 22,1951,408 kB java.text.DecimalFormat7,351 804 kB java.lang.String 32,828769 kB org.apache.tomcat.util.http.MimeHeaderField 28,098658 kB java.util.HashMap 15,598609 kB java.util.GregorianCalendar
Re: Tomcat Memory Leak
Did you try explicitly setting all those Hashmaps/Hashtables references to null. Since you already mentioned that your are taking care of all your Resultsets etc that doesent sound like an issue. I tried a small jsp example where I created a hashtable but never explicitly dereference it and the freememory seems to reduce continuosly. When I do a gc run though the memory seems to get freed. Hope this helps. -Sameer Petkov, Rossen [EMAIL PROTECTED] wrote: Hello, I am having a problem with Tomcat 5.0.19 on windows with JDK 1.4.2_03.The memory that java.exe is using keeps growing till the point that tomcat Runs out of memory. Using a profiler, doesn't seem to help me much. I can see the memory being used by certain classes go up (mainly char[] and byte[] and some tomcat classes, please see the tables below) and even reach all the way to the point that used java heap equals to the java heap, then GC probably kicks but, while running Tomcat throws an OutOfMemory exception. I have allocated -Xmx896M. I'm now forcing a GC when the free memory drops to 15%. With every GC, the freed memory is less and less, which to me is an indication of memory leak. I can't figure out where all those char[] objects are coming from or why they aren't being reclaimed by the garbage collector. I know that something is holding memory and isn't letting it go, and I know that the leaked memory consists of char[] and byte[] objects (see below tables). What I can't figure out is how to determine what's doing the leaking. After several hours of heavy usage, the GC runs and frees less memory than the previous run. This gives me on day of normal operation and I have to restart Tomcat after hours to be ready for the next day, not a really acceptable solution. I noticed the 3 tomcat classes: org.apache.tomcat.util.buf.MessageBytes, org.apache.tomcat.util.buf.ByteChunk and org.apache.tomcat.util.buf.CharChunk. The memory occupied my these seems to never be released. Can they be the cause of the multiple byte[] and char[]? Some info about the application/environment: - Tomcat 5.0.19 on windows with JDK 1.4.2_03. - MVC type web application - front Controller dispathing requests to business classes and forwards to appropriate JSP, passing necessary data objects in the request object - heavy JDBC use and DAO/DTO components, mainly using PreparedStatement - Oracle stored procedures and functions acccessed thru CallableStatement - Oracle database I am doing the usual for closing all jdbc database related objects like ResultSet, PreparedStatement and connections. Here are some thoughts that I have, that could be the reason for the leak, these are more questions: 1. DTO objects are being passed from the data layer to the business layer and finnaly to the JSP. After using the DTOs on the JSP, they are not explicitly set to null in the JSP. I see that all DTO declarations are in the service method of the compiled JSPs. Can this be a problem? 2. HashMaps, HashTables and LinkedHashMaps are being passed the same way thru the layers and end up in the JSPs. These are not set to null either. Can this be a problem? 3. PreparedStatement and CallableStatement are always closed, but not always set to null. Can any of these be the cause? Below are some metrics from my environemnt: After a several hours of heavy usage, BEFORE GC: Name Instance countSize char[ ]2,200,184 425,721 kB byte[ ]199,003 178,902 kB java.lang.String 1,825,003 42,773 kB java.lang.StringBuffer 925,351 21,687 kB [ ] 679,935 19,181 kB org.apache.naming.resources.FileDirContext$FileResourceAttributes 122,254 8,595 kB org.apache.tomcat.util.buf.MessageBytes117,876 5,525 kB org.apache.tomcat.util.buf.ByteChunk 135,061 5,275 kB org.apache.tomcat.util.buf.CharChunk 132,558 5,178 kB java.util.HashMap$ValueIterator97,5513,04 ...more AFTER GC: This is the top of the list, sorted by size: Name Instance countSize byte[ ]47,866167,877 kB char[ ]69,387151,906 kB org.apache.tomcat.util.buf.MessageBytes117,928 5,527 kB org.apache.tomcat.util.buf.ByteChunk 135,120 5,278 kB org.apache.tomcat.util.buf.CharChunk 132,616 5,180 kB [ ] 71,5504,711 kB int[ ] 22,1951,408 kB java.text.DecimalFormat7,351 804 kB java.lang.String 32,828
Re: Tomcat Memory Leak
If you are using the AJP/1.3 Connector, then 5.0.19 has a very very very very well known memory leak. You need to set request.registerRequests=false in this case. Either that, or upgrade :). Petkov, Rossen [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, I am having a problem with Tomcat 5.0.19 on windows with JDK 1.4.2_03.The memory that java.exe is using keeps growing till the point that tomcat Runs out of memory. Using a profiler, doesn't seem to help me much. I can see the memory being used by certain classes go up (mainly char[] and byte[] and some tomcat classes, please see the tables below) and even reach all the way to the point that used java heap equals to the java heap, then GC probably kicks but, while running Tomcat throws an OutOfMemory exception. I have allocated -Xmx896M. I'm now forcing a GC when the free memory drops to 15%. With every GC, the freed memory is less and less, which to me is an indication of memory leak. I can't figure out where all those char[] objects are coming from or why they aren't being reclaimed by the garbage collector. I know that something is holding memory and isn't letting it go, and I know that the leaked memory consists of char[] and byte[] objects (see below tables). What I can't figure out is how to determine what's doing the leaking. After several hours of heavy usage, the GC runs and frees less memory than the previous run. This gives me on day of normal operation and I have to restart Tomcat after hours to be ready for the next day, not a really acceptable solution. I noticed the 3 tomcat classes: org.apache.tomcat.util.buf.MessageBytes, org.apache.tomcat.util.buf.ByteChunk and org.apache.tomcat.util.buf.CharChunk. The memory occupied my these seems to never be released. Can they be the cause of the multiple byte[] and char[]? Some info about the application/environment: - Tomcat 5.0.19 on windows with JDK 1.4.2_03. - MVC type web application - front Controller dispathing requests to business classes and forwards to appropriate JSP, passing necessary data objects in the request object - heavy JDBC use and DAO/DTO components, mainly using PreparedStatement - Oracle stored procedures and functions acccessed thru CallableStatement - Oracle database I am doing the usual for closing all jdbc database related objects like ResultSet, PreparedStatement and connections. Here are some thoughts that I have, that could be the reason for the leak, these are more questions: 1. DTO objects are being passed from the data layer to the business layer and finnaly to the JSP. After using the DTOs on the JSP, they are not explicitly set to null in the JSP. I see that all DTO declarations are in the service method of the compiled JSPs. Can this be a problem? 2. HashMaps, HashTables and LinkedHashMaps are being passed the same way thru the layers and end up in the JSPs. These are not set to null either. Can this be a problem? 3. PreparedStatement and CallableStatement are always closed, but not always set to null. Can any of these be the cause? Below are some metrics from my environemnt: After a several hours of heavy usage, BEFORE GC: Name Instance countSize char[ ]2,200,184 425,721 kB byte[ ]199,003 178,902 kB java.lang.String 1,825,003 42,773 kB java.lang.StringBuffer 925,351 21,687 kB class[ ] 679,935 19,181 kB org.apache.naming.resources.FileDirContext$FileResourceAttributes 122,254 8,595 kB org.apache.tomcat.util.buf.MessageBytes117,876 5,525 kB org.apache.tomcat.util.buf.ByteChunk 135,061 5,275 kB org.apache.tomcat.util.buf.CharChunk 132,558 5,178 kB java.util.HashMap$ValueIterator97,5513,04 ...more AFTER GC: This is the top of the list, sorted by size: Name Instance countSize byte[ ]47,866167,877 kB char[ ]69,387151,906 kB org.apache.tomcat.util.buf.MessageBytes117,928 5,527 kB org.apache.tomcat.util.buf.ByteChunk 135,120 5,278 kB org.apache.tomcat.util.buf.CharChunk 132,616 5,180 kB class[ ] 71,5504,711 kB int[ ] 22,1951,408 kB java.text.DecimalFormat7,351 804 kB java.lang.String 32,828769 kB org.apache.tomcat.util.http.MimeHeaderField28,098658 kB java.util.HashMap 15,598609 kB java.util.GregorianCalendar7,351