Tomcat抱怨线程未停止

我收到有关启动线程而不是结束线程或停止线程的异常信息. WebappClassLoader抱怨这些线程将导致内存泄漏.

 

这是怎么回事

>这样的线程是否有可能导致内存泄漏?还是可能?
>卡塔琳娜(Catalina)是否过于敏感?
>这甚至是有效的编程技术吗?

(管理Tomcat应用程序的这一方面对我来说是新手.但是,由于Web应用程序在高负载下数据库连接即将用尽时,我必须学习它,这需要解决.寻找内存泄漏是我们要做的许多事情之一正在调查.)

最佳答案

您可以在http://wiki.apache.org/tomcat/MemoryLeakProtection处了解Tomcat中棘手的内存泄漏问题(尤其是此警告),尤其是对于警告,您将看到:

 

 

If a webapp creates a thread, by default its context classloader is set to the one of the parent thread (the thread that created the new thread). In a webapp, this parent thread is one of tomcat worker threads, whose context classloader is set to the webapp classloader when it executes webapp code.

Furthermore, the spawned thread may be executing (or blocked in) some code that involves classes loaded by the webapp, thus preventing the webapp classloader from being collected.

So, if the spawned thread is not properly terminated when the application is stopped, the webapp classloader will leak because of the strong reference held by the spawned thread.

当您一次启动Web应用程序,然后将其拆解时,这种影响(以我的经验)是有限的.但是,在某些情况下,例如在连续集成方案中(CI服务器将应用程序的构建重复部署到未重新启动的Tomcat容器中),您可能会很快耗尽JVM中的内存.最终,这将在PermGen区域中将自身表现为OutOfMemoryException(假设您使用的是Sun / Oracle JVM).有关PermGen的更多详细信息,请参见http://blogs.oracle.com/fkieviet/entry/classloader_leaks_the_dreaded_java

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值