[
http://mifosforge.jira.com/browse/MIFOS-2433?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=60101#action_60101
]
Udai Gupta commented on MIFOS-2433:
-----------------------------------
I am removing printing unclosed thread from contextDestory which was part of
patch attached to this issue.
Reason: Now tomcat provides: *JRE Memory Leak Prevention Listener*
(http://tomcat.apache.org/tomcat-6.0-doc/config/listeners.html#Nested_Components).
The problem is that Tomcat does not garbage collect the Classloader and the
classes it loads. Each you reload the webapp context,
more copies of these classes are loaded, and as these are stored in the
permanent heap generation, it will eventually run out of memory.
The same issue could affect (and affects) any container. You just have to
restart the container instead of restarting the context.
It's easy to reproduce this problem by reloading the context over and over
again until you get an OutOfMemoryError
(10 times was enough for any average memory requirement application).
* See Sun JDK Bug http://bugs.sun.com/view_bug.do?bug_id=4957990 (upgrade to
JDK 6u21(b01))
We might have to play with JVM GC options or try some other JVMs (like JRockit)
CMS garbage collection -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled
-XX:+CMSPermGenSweepingEnabled
Apart from that we have HibernateUtil TheardLocal variable for Hibernate
Session holder need to be cleaned
c3p0 connection pooling Theads should be destroyed at reload (spring
configuration destroy seems working at restarting the container)
Logs at loggerconfiguration.xml at WARN
{noformat}
18 Sep, 2010 1:27:37 AM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8083
18 Sep, 2010 1:27:37 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 576 ms
18 Sep, 2010 1:27:37 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
18 Sep, 2010 1:27:37 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.26
18 Sep, 2010 1:27:39 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
18 Sep, 2010 1:27:58 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'cheetah'
18 Sep, 2010 1:28:00 AM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8083
18 Sep, 2010 1:28:00 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
18 Sep, 2010 1:28:00 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/30 config=null
18 Sep, 2010 1:28:00 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 23071 ms
18 Sep, 2010 1:28:41 AM org.apache.catalina.core.StandardContext reload
INFO: Reloading this Context has started
18 Sep, 2010 1:28:41 AM org.apache.catalina.core.ApplicationContext log
INFO: Destroying Spring FrameworkServlet 'cheetah'
18 Sep, 2010 1:28:46 AM org.apache.catalina.core.StandardContext listenerStop
SEVERE: Exception sending context destroyed event to listener instance of class
org.mifos.framework.ApplicationInitializer
18 Sep, 2010 1:28:46 AM org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
18 Sep, 2010 1:28:46 AM org.apache.catalina.core.ApplicationContext log
INFO: Shutting down log4j
18 Sep, 2010 1:28:46 AM org.apache.catalina.loader.WebappClassLoader
clearReferencesThreads
SEVERE: A web application appears to have started a thread named [Thread-1] but
has failed to stop it. This is very likely to create a memory leak.
18 Sep, 2010 1:28:46 AM org.apache.catalina.loader.WebappClassLoader
clearReferencesStopTimerThread
SEVERE: A web application appears to have started a TimerThread named [Timer-0]
via the java.util.Timer API but has failed to stop it. To prevent a memory
leak, the timer (and hence the associated thread) has been forcibly cancelled.
18 Sep, 2010 1:28:46 AM org.apache.catalina.loader.WebappClassLoader
clearReferencesThreads
SEVERE: A web application appears to have started a thread named
[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0] but has
failed to stop it. This is very likely to create a memory leak.
18 Sep, 2010 1:28:46 AM org.apache.catalina.loader.WebappClassLoader
clearReferencesThreads
SEVERE: A web application appears to have started a thread named
[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1] but has
failed to stop it. This is very likely to create a memory leak.
18 Sep, 2010 1:28:46 AM org.apache.catalina.loader.WebappClassLoader
clearReferencesThreads
SEVERE: A web application appears to have started a thread named
[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2] but has
failed to stop it. This is very likely to create a memory leak.
18 Sep, 2010 1:28:46 AM org.apache.catalina.loader.WebappClassLoader
clearReferencesStopTimerThread
SEVERE: A web application appears to have started a TimerThread named [Timer-1]
via the java.util.Timer API but has failed to stop it. To prevent a memory
leak, the timer (and hence the associated thread) has been forcibly cancelled.
18 Sep, 2010 1:28:46 AM org.apache.catalina.loader.WebappClassLoader
clearReferencesThreads
SEVERE: A web application appears to have started a thread named
[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0] but has
failed to stop it. This is very likely to create a memory leak.
18 Sep, 2010 1:28:46 AM org.apache.catalina.loader.WebappClassLoader
clearReferencesThreads
SEVERE: A web application appears to have started a thread named
[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1] but has
failed to stop it. This is very likely to create a memory leak.
18 Sep, 2010 1:28:46 AM org.apache.catalina.loader.WebappClassLoader
clearReferencesThreads
SEVERE: A web application appears to have started a thread named
[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2] but has
failed to stop it. This is very likely to create a memory leak.
18 Sep, 2010 1:28:46 AM org.apache.catalina.loader.WebappClassLoader
clearReferencesThreads
SEVERE: A web application appears to have started a thread named
[schedulerFactoryBean_Worker-1] but has failed to stop it. This is very likely
to create a memory leak.
18 Sep, 2010 1:28:46 AM org.apache.catalina.loader.WebappClassLoader
clearThreadLocalMap
SEVERE: A web application created a ThreadLocal with key of type
[java.lang.ThreadLocal] (value [java.lang.threadlo...@4837e964]) and a value of
type [org.mifos.framework.components.audit.util.helpers.AuditInterceptor]
(value
[org.mifos.framework.components.audit.util.helpers.auditintercep...@4ebbc946])
but failed to remove it when the web application was stopped. To prevent a
memory leak, the ThreadLocal has been forcibly removed.
18 Sep, 2010 1:28:46 AM org.apache.catalina.loader.WebappClassLoader
clearThreadLocalMap
SEVERE: A web application created a ThreadLocal with key of type
[java.lang.ThreadLocal] (value [java.lang.threadlo...@a9b3b0c]) and a value of
type [org.hibernate.impl.SessionImpl] (value THERE IS LOTS OF DATA) but failed
to remove it when the web application was stopped. To prevent a memory leak,
the ThreadLocal has been forcibly removed.
log4j:ERROR LogMananger.repositorySelector was null likely due to error in
class reloading, using NOPLoggerRepository.
- ConfigurationLocator found configuration file:
/home/ugupta/Projects/Mifos/deploy/mifos_v1.6.x/config/loggerconfiguration.xml
2010-09-18/01:28:50.452/IST WARN,
com.mchange.v2.c3p0.management.ActiveManagementCoordinator, ?, ?, ?, A
C3P0Registry mbean is already registered. This probably means that an
application using c3p0 was undeployed, but not all PooledDataSources were
closed prior to undeployment. This may lead to resource leaks over time. Please
take care to close all PooledDataSources.
Exception in thread "ContainerBackgroundProcessor[StandardEngine[Catalina]]"
java.lang.OutOfMemoryError: PermGen space
{noformat}
> Tomcat reload fails
> -------------------
>
> Key: MIFOS-2433
> URL: http://mifosforge.jira.com/browse/MIFOS-2433
> Project: mifos
> Issue Type: Bug
> Components: Build and Testing
> Affects Versions: Release 1.3
> Environment: Platform: All, OS: All
> Reporter: Adam Monsen
> Assignee: mifosdeveloperqueue
> Priority: Major
> Fix For: Gazelle Backlog
>
> Attachments: issue_2433.diff
>
>
> Reloading of Web applications is a handy feature of Tomcat (and other
> application servers) that can reduce development time. The Mifos Web
> application
> breaks after being reloaded by Tomcat.
> STEPS TO REPRODUCE
> 1) in a stand-alone Tomcat server
> a) deploy the Mifos war into CATALINA_HOME/webapps
> b) start Tomcat, watch log
> c) login to Mifos, logout
> d) visit http://localhost:8080/manager/html/reload?path=/mifos
> (may take several reloads)
> 2) in the Eclipse WTP
> a) enable auto-reloading for your Mifos/Tomcat server
> b) change some Java code, save (force build if necessary)
> (may take several changes)
> EXPECTED BEHAVIOR
> Mifos reloads and works nominally.
> ACTUAL BEHAVIOR
> * Trying to request any Mifos page results in 404 or 500 errors
> * Log shows messages like
> Exception in thread "Timer-0" java.lang.NullPointerException
> Exception in thread "ContainerBackgroundProcessor[StandardEngine[Catalina]]"
> java.lang.OutOfMemoryError: PermGen space
> Exception in thread "Timer-2" java.lang.NullPointerException
> java.lang.reflect.InvocationTargetException
> Exception in thread "main" java.lang.OutOfMemoryError: PermGen space
> ADDITIONAL INFORMATION
> The inability for Tomcat to reload Mifos may be the result of missing cleanup
> steps in ApplicationInitializer#contextDestroyed()
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://mifosforge.jira.com/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Mifos-issues mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mifos-issues