gpt4 book ai didi

apache - tomcat6 : memory leak when stopping

转载 作者:行者123 更新时间:2023-11-28 22:13:07 24 4
gpt4 key购买 nike

每次当我停止 tomcat6 时,我都会发生内存泄漏。这是来 self 的 catalina.out:

Mar 10, 2014 5:21:01 PM org.apache.coyote.http11.Http11Protocol pause
INFO: Pausing Coyote HTTP/1.1 on http-8080
Mar 10, 2014 5:21:02 PM org.apache.catalina.core.StandardService stop
INFO: Stopping service Catalina
17:21:02,852 INFO XmlWebApplicationContext:696 - Closing org.springframework.web.context.support.XmlWebApplicationContext@1ba6b028: display name [WebApplicationContext for namespace 'documation-servlet']; startup date [Mon Mar 10 17:17:34 EDT 2014]; parent: org.springframework.web.context.support.XmlWebApplicationContext@57af0af7
17:21:02,853 INFO DefaultListableBeanFactory:282 - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@fb7f97b: defining beans [propertyConfigurer,methodNameResolver,exportController,managerController,urlMapping,viewResolver]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@2e2e1b6c
17:21:02,938 INFO XmlWebApplicationContext:696 - Closing org.springframework.web.context.support.XmlWebApplicationContext@57af0af7: display name [Root WebApplicationContext]; startup date [Mon Mar 10 17:17:28 EDT 2014]; root of context hierarchy
17:21:02,938 INFO DefaultListableBeanFactory:282 - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@2e2e1b6c: defining beans [propertyConfigurer,documationDataSource,upsDataSource,securityFilter,documationXactionManager,aclService,libraryService,librarySearchService,inspectionService,approvalService,resourceMgr,zkService,mailerService,libraryServiceTX,librarySearchServiceTX,zkServiceTX,approvalServiceTX,inspectionServiceTX,aclServiceTX,appCacheManager,methodCachingAdvice]; root of factory hierarchy
17:21:02,939 INFO EhCacheManagerFactoryBean:143 - Shutting down EHCache CacheManager
Mar 10, 2014 5:21:02 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: A web application appears to have started a thread named [Timer-2] but has failed to stop it. This is very likely to create a memory leak.
Mar 10, 2014 5:21:02 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: A web application appears to have started a thread named [Resource Destroyer in BasicResourcePool.close()] but has failed to stop it. This is very likely to create a memory leak.
Mar 10, 2014 5:21:02 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: A web application appears to have started a thread named [Resource Destroyer in BasicResourcePool.close()] but has failed to stop it. This is very likely to create a memory leak.
Mar 10, 2014 5:21:02 PM org.apache.coyote.http11.Http11Protocol destroy
INFO: Stopping Coyote HTTP/1.1 on http-8080

我正在为我的应用程序使用 spring 框架和 zk 框架。知道是什么原因造成的吗?

最佳答案

与@Garreth 所说的相反,您很可能有内存泄漏。如果您从不重新部署旅游 Web 应用程序并且总是在部署之间关闭 JVM,那么它可能根本没有任何区别。但是拥有一个可重新部署的 Web 应用程序是件好事,对吧?

您有一个或多个组件在某个时刻启动线程,但没有清理它们。 BasicResourcesPool 是您可以通过查看自己的代码和您正在使用的任何库提供的类来快速找到的东西。

Timer-2 更难追踪,因为它有一个通用名称。

如果您有机会附加一个探查器,您可以跟踪对象和/或线程的创建并查看哪个组件正在启动这些线程。启动这些有问题的组件的任何组件(监听器、servlet 等)都需要在取消部署应用程序时正确关闭它们。考虑使用 Servlet.destroyServletContextListener.contextDestroyed 来执行此类清理操作。

关于apache - tomcat6 : memory leak when stopping,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22311664/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com