这是非常有可能创造Tomcat的内存泄漏? [英] Is this very likely to create a memory leak in Tomcat?

查看:3394
本文介绍了这是非常有可能创造Tomcat的内存泄漏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我Tomcat配置了不同的外部开源工作。

不过,Tomcat是运行了几分钟后我得到:


  

重度:Web应用程序创建了一个ThreadLocal [/ MyProject的]
  类型[java.lang.ThreadLocal中(价值的关键
  [java.lang.ThreadLocal@1b3f02f])和类型的值
  [org.apache.axis.MessageContext](值
  [org.apache.axis.MessageContext@5dbd4e]),但未能在删除
  Web应用程序已停止。这很可能造成
  内存泄漏。


这是什么原因呢?

在哪里有看?难道是数据池在Tomcat?

和意味着什么呢线程在Tomcat中?

EDITED

下面是我的全部跟踪。该应用程序似乎重新加载它的上下文,而它仍在运行! - 我不知道为什么。

  2011年3月13日下午10点56分十二秒org.apache.catalina.core.StandardContext重装
INFO:重新加载此背景下已开始
2011年3月13日下午10时56分十二秒org.apache.catalina.core.StandardWrapper卸载
信息:等待1个实例(县)被释放
2011年3月13日下午10时56分十三秒org.apache.catalina.core.StandardWrapper卸载
信息:等待1个实例(县)被释放
2011年3月13日下午10点56分14秒org.apache.catalina.core.StandardWrapper卸载
信息:等待1个实例(县)被释放
2011年3月13日下午10点56分14秒org.apache.catalina.core.ApplicationContext日志
INFO:关闭春根的WebApplicationContext
2011年3月13日下午10时56分15秒org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
重度:Web应用程序[/ MyProject的]注册的JBDC司机[com.mysql.jdbc.Driver],但未能注销的Web应用程序停止时。以prevent内存泄漏,JDBC驱动程序被强制注销。
2011年3月13日下午10时56分15秒org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
重度:Web应用程序[/ MyProject的]注册的JBDC司机[oracle.jdbc.driver.OracleDriver],但未能注销的Web应用程序停止时。以prevent内存泄漏,JDBC驱动程序被强制注销。
2011年3月13日下午10时56分15秒org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
重度:Web应用程序[/ MyProject的]似乎已经开始了一个名为[NioSocketAcceptor-1]线程,但未能阻止它。这很可能造成内存泄漏。
2011年3月13日下午10时56分15秒org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
重度:Web应用程序[/ MyProject的]似乎已经开始了一个名为[NioProcessor-1]线程,但未能阻止它。这很可能造成内存泄漏。
2011年3月13日下午10时56分15秒org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
重度:Web应用程序[/ MyProject的]似乎已经开始了一个名为[NioProcessor-4线程,但未能阻止它。这很可能造成内存泄漏。
2011年3月13日下午10时56分15秒org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
重度:Web应用程序[/ MyProject的]似乎已经开始了一个名为[bitronix盘力-配料]线程,但未能阻止它。这很可能造成内存泄漏。
2011年3月13日下午10时56分15秒org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
重度:Web应用程序[/ MyProject的]似乎已经开始了一个名为[bitronix-调度]线程,但未能阻止它。这很可能造成内存泄漏。
2011年3月13日下午10时56分15秒org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
重度:Web应用程序[/ MyProject的]仍在处理,目前尚未完成的请求。这很可能造成内存泄漏。可以控制允许请求通过使用标准的背景信息执行unloadDelay属性来完成的时间。
2011年3月13日下午10时56分15秒org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
重度:Web应用程序[/ MyProject的]似乎已经开始了一个名为[NioProcessor-7]线程,但未能阻止它。这很可能造成内存泄漏。
2011年3月13日下午10时56分15秒org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
重度:Web应用程序[/ MyProject的]似乎已经开始了一个名为[NioProcessor-2线程,但未能阻止它。这很可能造成内存泄漏。
2011年3月13日下午10时56分15秒org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
重度:Web应用程序[/ MyProject的]创造型的关键一个ThreadLocal [java.lang.ThreadLocal中(值[java.lang.ThreadLocal@1b5a8e1])和类型[org.mvel2.debug.DebuggerContext]值(值[org.mvel2.debug.DebuggerContext@16259fd]),但失败的Web应用程序停止时将其删除。这很可能造成内存泄漏。
2011年3月13日下午10时56分15秒org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
重度:Web应用程序[/ MyProject的]创建一个ThreadLocal类型[org.apache.axis.utils.XMLUtils.ThreadLocalDocumentBuilder](值[org.apache.axis.utils.XMLUtils$ThreadLocalDocumentBuilder@84b0b4])和数值的关键类型[com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl](值[com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl@16d2cfa]),但无法删除它时,Web应用程序已停止。这很可能造成内存泄漏。
2011年3月13日下午10时56分15秒org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
重度:Web应用程序[/ MyProject的]创建一个ThreadLocal类型的键[空](值[com.sun.faces.util.Util$1@16bbac9])和类型[的java.util.HashMap]值(值[{com.sun.faces.patternCache = {=}}]),但未能Web应用程序停止时将其删除。这很可能造成内存泄漏。
2011年3月13日下午10时56分15秒org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
重度:Web应用程序[/ MyProject的]创建一个ThreadLocal类型[java.lang.ThreadLocal中(值[java.lang.ThreadLocal@1b3f02f])和类型[org.apache.axis.MessageContext]值的键(值[org.apache.axis.MessageContext@5dbd4e]),但失败的Web应用程序停止时将其删除。这很可能造成内存泄漏。
2011年3月13日下午10时56分15秒org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
重度:Web应用程序[/ MyProject的]创建一个ThreadLocal类型[org.apache.axis.utils.XMLUtils.ThreadLocalDocumentBuilder](值[org.apache.axis.utils.XMLUtils$ThreadLocalDocumentBuilder@84b0b4])和数值的关键类型[com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl](值[com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl@378584]),但无法删除它时,Web应用程序已停止。这很可能造成内存泄漏。
2011年3月13日下午10时56分15秒org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
重度:Web应用程序[/ MyProject的]创建一个ThreadLocal类型的键[org.springframework.core.NamedThreadLocal](值[事务资源])和类型[的java.util.HashMap]值(值[{org.hibernate.impl.SessionFactoryImpl@ccc27b=org.springframework.orm.hibernate3.SessionHolder@4f6ada}])但未能当Web应用程序已停止。这很可能造成内存泄漏将其删除。
2011年3月13日下午10时56分15秒org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
重度:Web应用程序[/ MyProject的]创建一个ThreadLocal类型[空](值[com.sun.faces.application.ApplicationAssociate$1@1f01fcf])和类型[com.sun.faces.application的价值的关键。 ApplicationAssociate](值[com.sun.faces.application.ApplicationAssociate@1b85528​​]),但失败的Web应用程序停止时将其删除。这很可能造成内存泄漏。
2011-03-13 22:57:27,734 ERROR(ContextLoader.java:220) - 上下文初始化失败
org.springframework.beans.factory.BeanCreationException:错误创建一个名为豆'transactionManager的在类路径资源定义[的applicationContext-hibernate.xml]:无法解析引用bean的SessionFactory的,而设置bean属性'SessionFactory的';嵌套的例外是org.springframework.beans.factory.BeanCreationException:错误创建一个名为豆'SessionFactory的在类路径资源定义[的applicationContext-hibernate.xml]:init方法的调用失败;嵌套的例外是java.lang.OutOfMemoryError:Java堆空间
    在org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
    在org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
    在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1325)


解决方案

该消息实际上是pretty清楚:一些创建的ThreadLocal 与类型的值 org.apache.axis.MessageContext - 这是一个很大的提示。这很可能意味着Apache Axis的框架忘记/后本身未能清理。同样问题的logback中,例如发生。不应该去多,但报告给轴团队中的错误可能是一个不错的主意。

因为的ThreadLocal ,则每个HTTP工作线程创建的Tomcat报告该错误。您的应用程序被卸载,但HTTP线程仍然存在 - 而这些的ThreadLocal 取值为好。当这些线程在未来被重新使用,这可能导致内存泄漏( org.apache.axis.MessageContext 不能被卸载)和一些问题。

有关详细信息,请参见:<一href=\"http://wiki.apache.org/tomcat/MemoryLeakProtection\">http://wiki.apache.org/tomcat/MemoryLeakProtection

I configured tomcat to work with a different external open source.

However, after the tomcat is running for a few minutes I get:

SEVERE: The web application [/MyProject] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@1b3f02f]) and a value of type [org.apache.axis.MessageContext] (value [org.apache.axis.MessageContext@5dbd4e]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.

What could cause it?

Where do I have to look? Could it be datapooling on Tomcat?

And what does it mean Threads in Tomcat?

EDITED

Here is my full trace. The application seems to reloads its context while it's still running - and I don't know why!

Mar 13, 2011 10:56:12 PM org.apache.catalina.core.StandardContext reload
INFO: Reloading this Context has started
Mar 13, 2011 10:56:12 PM org.apache.catalina.core.StandardWrapper unload
INFO: Waiting for 1 instance(s) to be deallocated
Mar 13, 2011 10:56:13 PM org.apache.catalina.core.StandardWrapper unload
INFO: Waiting for 1 instance(s) to be deallocated
Mar 13, 2011 10:56:14 PM org.apache.catalina.core.StandardWrapper unload
INFO: Waiting for 1 instance(s) to be deallocated
Mar 13, 2011 10:56:14 PM org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
Mar 13, 2011 10:56:15 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE: The web application [/MyProject] registered the JBDC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
Mar 13, 2011 10:56:15 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE: The web application [/MyProject] registered the JBDC driver [oracle.jdbc.driver.OracleDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
Mar 13, 2011 10:56:15 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/MyProject] appears to have started a thread named [NioSocketAcceptor-1] but has failed to stop it. This is very likely to create a memory leak.
Mar 13, 2011 10:56:15 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/MyProject] appears to have started a thread named [NioProcessor-1] but has failed to stop it. This is very likely to create a memory leak.
Mar 13, 2011 10:56:15 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/MyProject] appears to have started a thread named [NioProcessor-4] but has failed to stop it. This is very likely to create a memory leak.
Mar 13, 2011 10:56:15 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/MyProject] appears to have started a thread named [bitronix-disk-force-batcher] but has failed to stop it. This is very likely to create a memory leak.
Mar 13, 2011 10:56:15 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/MyProject] appears to have started a thread named [bitronix-scheduler] but has failed to stop it. This is very likely to create a memory leak.
Mar 13, 2011 10:56:15 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/MyProject] is still processing a request that has yet to finish. This is very likely to create a memory leak. You can control the time allowed for requests to finish by using the unloadDelay attribute of the standard Context implementation.
Mar 13, 2011 10:56:15 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/MyProject] appears to have started a thread named [NioProcessor-7] but has failed to stop it. This is very likely to create a memory leak.
Mar 13, 2011 10:56:15 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/MyProject] appears to have started a thread named [NioProcessor-2] but has failed to stop it. This is very likely to create a memory leak.
Mar 13, 2011 10:56:15 PM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application [/MyProject] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@1b5a8e1]) and a value of type [org.mvel2.debug.DebuggerContext] (value [org.mvel2.debug.DebuggerContext@16259fd]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
Mar 13, 2011 10:56:15 PM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application [/MyProject] created a ThreadLocal with key of type [org.apache.axis.utils.XMLUtils.ThreadLocalDocumentBuilder] (value [org.apache.axis.utils.XMLUtils$ThreadLocalDocumentBuilder@84b0b4]) and a value of type [com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl] (value [com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl@16d2cfa]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
Mar 13, 2011 10:56:15 PM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application [/MyProject] created a ThreadLocal with key of type [null] (value [com.sun.faces.util.Util$1@16bbac9]) and a value of type [java.util.HashMap] (value [{com.sun.faces.patternCache={ = }}]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
Mar 13, 2011 10:56:15 PM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application [/MyProject] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@1b3f02f]) and a value of type [org.apache.axis.MessageContext] (value [org.apache.axis.MessageContext@5dbd4e]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
Mar 13, 2011 10:56:15 PM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application [/MyProject] created a ThreadLocal with key of type [org.apache.axis.utils.XMLUtils.ThreadLocalDocumentBuilder] (value [org.apache.axis.utils.XMLUtils$ThreadLocalDocumentBuilder@84b0b4]) and a value of type [com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl] (value [com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl@378584]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
Mar 13, 2011 10:56:15 PM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application [/MyProject] created a ThreadLocal with key of type [org.springframework.core.NamedThreadLocal] (value [Transactional resources]) and a value of type [java.util.HashMap] (value [{org.hibernate.impl.SessionFactoryImpl@ccc27b=org.springframework.orm.hibernate3.SessionHolder@4f6ada}]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
Mar 13, 2011 10:56:15 PM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application [/MyProject] created a ThreadLocal with key of type [null] (value [com.sun.faces.application.ApplicationAssociate$1@1f01fcf]) and a value of type [com.sun.faces.application.ApplicationAssociate] (value [com.sun.faces.application.ApplicationAssociate@1b85528]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
2011-03-13 22:57:27,734 ERROR (            ContextLoader.java:220)     - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in class path resource [applicationContext-hibernate.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext-hibernate.xml]: Invocation of init method failed; nested exception is java.lang.OutOfMemoryError: Java heap space
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1325)

解决方案

The message is actually pretty clear: something creates a ThreadLocal with value of type org.apache.axis.MessageContext - this is a great hint. It most likely means that Apache Axis framework forgot/failed to cleanup after itself. The same problem occurred for instance in Logback. You shouldn't bother much, but reporting a bug to Axis team might be a good idea.

Tomcat reports this error because the ThreadLocals are created per HTTP worker threads. Your application is undeployed but HTTP threads remain - and these ThreadLocals as well. This may lead to memory leaks (org.apache.axis.MessageContext can't be unloaded) and some issues when these threads are reused in the future.

For details see: http://wiki.apache.org/tomcat/MemoryLeakProtection

这篇关于这是非常有可能创造Tomcat的内存泄漏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆