Web 应用程序似乎启动了名为 [22] 的线程,但未能停止它。这很可能会造成内存泄漏
我有一个 Web 应用程序,后端有 Servlet,部署在 tomcat 上。该应用程序是简单的java应用程序。
我经常在服务器日志中看到此错误: 严重:Web 应用程序似乎启动了一个名为 [22]但未能阻止它。这很有可能 造成内存泄漏。
是否存在任何可能导致这种情况的潜在原因?
I have a web application with Servlets in the back end deployed over tomcat. The application is simple java application.
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. This is very likely
to create a memory leak.
Are there any potential reasons which might be causing it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我会使用 visualvm 1.3.2 并查看正在创建哪些线程。请务必添加所有插件。
如果它不是由您的代码完成的,您将无法对其进行太多控制。
您也不知道该消息是否是转移注意力的信息。在一段时间内对代码进行负载测试并测量发生的情况。
I'd use visualvm 1.3.2 and see what threads are being created. 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.
我最近遇到了类似的情况,按以下步骤解决
如果您将Thread设置为Dameon Thread,则没有帮助,您可以访问说明。
I faced similar situation recently Resolved in below steps
If you set Thread as Dameon Thread it is not going to help , you can visit explanation.
Tomcat 等待所有应用程序的线程(用户线程而不是守护程序线程)在停止之前停止,我猜在您的情况下,这个特定线程是用户线程,因此 tomcat 生成了此错误。
我建议你将此线程更改为守护进程(假设这是你的)
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.
I suggest you to change this thread to daemon (assuming this one is yours)