简体   繁体   English

Web应用程序似乎已启动名为[22]的线程但未能阻止它。 这很可能造成内存泄漏

[英]A web application appears to have started a thread named [22] but has failed to stop it. This is very likely to create a memory leak

I have a web application with Servlets in the back end deployed over tomcat. 我有一个Web应用程序,后端使用Servlet部署在tomcat上。 The application is simple java application. 该应用程序是简单的Java应用程序

I see this error frequently in the server logs: SEVERE: A web application appears to have started a thread named [22] but has failed to stop it. 我经常在服务器日志中看到这个错误:严重:Web应用程序似乎已经启动了一个名为[22]但未能阻止它的线程。 This is very likely to create a memory leak. 这很可能造成内存泄漏。

Are there any potential reasons which might be causing it? 是否有可能导致它的潜在原因?

I'd use visualvm 1.3.2 and see what threads are being created. 我将使用visualvm 1.3.2并查看正在创建的线程。 Be sure to add all the plug-ins. 一定要添加所有插件。

If it's not being done by your code you won't have much control over it. 如果您的代码没有完成,您将无法控制它。

You also don't know if the message is a red herring or not. 您也不知道该消息是否是红鲱鱼。 Load test your code over a period of time and measure what happens. 在一段时间内对代码进行负载测试并测量发生的情况。

I faced similar situation recently Resolved in below steps 我最近遇到过类似的情况在下面的步骤中解决了

  1. I took Thread dump. 我接受了Thread dump。 ( using Kill -QUIT pid ) (使用Kill -QUIT pid)
  2. Found the Runnable/Thread class form dump 找到Runnable / Thread类表单转储
  3. Then i put a debug point in run method and started application in debug mode. 然后我在run方法中放入一个调试点,并在调试模式下启动应用程序。
  4. Got the code which starts My Thread and I observed it was not stopped while stoping application. 得到启动My Thread的代码,我发现它在停止应用程序时没有停止。
  5. Introduced code to stop the thread in contextDestroyed method of AppContextListener (This is My application class which extends ServletContextListener ) as this method will be called when i stop tomcat. 引入代码来停止AppContextListener的contextDestroyed方法中的线程(这是我的应用程序类,它扩展了ServletContextListener),因为当我停止tomcat时将调用此方法。

If you set Thread as Dameon Thread it is not going to help , you can visit explanation . 如果你将Thread设置为Dameon Thread它不会有帮助,你可以访问解释

Tomcat waits for all the application's threads (user threads not daemon threads) to stop before it goes down, I guess that in your case this specific thread is a user thread and therefore tomcat generated this error. Tomcat等待所有应用程序的线程(用户线程不是守护程序线程)在它关闭之前停止,我想在你的情况下这个特定的线程是用户线程,因此tomcat生成了这个错误。 I suggest you to change this thread to daemon (assuming this one is yours) 我建议你把这个线程改成守护进程(假设这个是你的)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 该Web应用程序似乎已启动一个名为的线程,但未能停止该线程。 这很可能造成内存泄漏 - The web application appears to have started a thread named but has failed to stop it. This is very likely to create a memory leak Web 应用程序似乎启动了一个名为 [Timer-0] 的线程,但未能停止它 - The web application appears to have started a thread named [Timer-0] but has failed to stop it Web应用程序[VehicleRouting]似乎已启动名为[drools-worker-4]的线程,但未能停止它 - The web application [VehicleRouting] appears to have started a thread named [drools-worker-4] but has failed to stop it 服务器由于[Pool-Cleaner]:Tomcat连接池而停止响应,但未能停止它。 这很可能造成内存泄漏 - Server Stop responding because of [Pool-Cleaner]:Tomcat Connection Pool but has failed to stop it. This is very likely to create a memory leak 如何解决 tomcat 内存泄漏警告 - Web 应用程序已启动一个线程但未能将其停止 - How to resolve tomcat memory leak warning - The web application have started a thread but has failed to stop it Quartz2.x:严重:Web应用程序[/ servlet]似乎已启动名为[Thread-4]的线程,但未能停止它 - Quartz2.x: GRAVE: The web application [/servlet] appears to have started a thread named [Thread-4] but has failed to stop it 无法停止辅助线程,可能会导致内存泄漏。 - Failed to stop the worker thread, likely to create a Memory leak. Servlet“已启动一个线程但未能阻止它” - Tomcat中的内存泄漏 - Servlet “has started a thread but failed to stop it” - memory leak in Tomcat Tomcat webapp错误-应用程序启动了线程[AWT-Windows],但未能将其停止-内存泄漏? - Tomcat webapp error - application started thread [AWT-Windows] but has failed to stop it - memory leak? 启动了一个名为MultiThreadedHttpConnectionManager清理的线程,但未能将其停止 - Started a thread named MultiThreadedHttpConnectionManager cleanup but has failed to stop it
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM