【问题标题】:Getting Memory Leak Errors on Server Stop (Eclipse, Hibernate, Spring)在服务器停止时获取内存泄漏错误(Eclipse、Hibernate、Spring)
【发布时间】:2015-09-21 06:11:00
【问题描述】:

当我取消部署战争(在 eclipse 上停止服务器)时,我得到以下日志。他们都很可疑,但我也更担心新工人#X。我正在使用 hibernate、spring (guice)、C3P0 库作为连接池。有什么想法吗?

2015-09-20 23:05:04.442 [localhost-startStop-2] [] ERROR o.a.c.loader.WebappClassLoader - The web application [] registered the JDBC 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.
2015-09-20 23:05:04.442 [localhost-startStop-2] [] ERROR o.a.c.loader.WebappClassLoader - The web application [] appears to have started a thread named [ForkJoinPool-2-worker-1] but has failed to stop it. This is very likely to create a memory leak.
2015-09-20 23:05:04.443 [localhost-startStop-2] [] ERROR o.a.c.loader.WebappClassLoader - The web application [] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak.
2015-09-20 23:05:04.443 [localhost-startStop-2] [] ERROR o.a.c.loader.WebappClassLoader - The web application [] appears to have started a thread named [java-sdk-http-connection-reaper] but has failed to stop it. This is very likely to create a memory leak.
2015-09-20 23:05:04.443 [localhost-startStop-2] [] ERROR o.a.c.loader.WebappClassLoader - The web application [] appears to have started a thread named [commons-pool-EvictionTimer] but has failed to stop it. This is very likely to create a memory leak.
2015-09-20 23:05:04.444 [localhost-startStop-2] [] ERROR o.a.c.loader.WebappClassLoader - The web application [] appears to have started a thread named [New I/O worker #1] but has failed to stop it. This is very likely to create a memory leak.
2015-09-20 23:05:04.444 [localhost-startStop-2] [] ERROR o.a.c.loader.WebappClassLoader - The web application [] appears to have started a thread named [New I/O worker #2] but has failed to stop it. This is very likely to create a memory leak.
2015-09-20 23:05:04.444 [localhost-startStop-2] [] ERROR o.a.c.loader.WebappClassLoader - The web application [] appears to have started a thread named [New I/O worker #3] but has failed to stop it. This is very likely to create a memory leak.
2015-09-20 23:05:04.444 [localhost-startStop-2] [] ERROR o.a.c.loader.WebappClassLoader - The web application [] appears to have started a thread named [New I/O worker #4] but has failed to stop it. This is very likely to create a memory leak.
2015-09-20 23:05:04.445 [localhost-startStop-2] [] ERROR o.a.c.loader.WebappClassLoader - The web application [] appears to have started a thread named [New I/O worker #5] but has failed to stop it. This is very likely to create a memory leak.
2015-09-20 23:05:04.445 [localhost-startStop-2] [] ERROR o.a.c.loader.WebappClassLoader - The web application [] appears to have started a thread named [New I/O worker #6] but has failed to stop it. This is very likely to create a memory leak.
2015-09-20 23:05:04.445 [localhost-startStop-2] [] ERROR o.a.c.loader.WebappClassLoader - The web application [] appears to have started a thread named [New I/O worker #7] but has failed to stop it. This is very likely to create a memory leak.
2015-09-20 23:05:04.445 [localhost-startStop-2] [] ERROR o.a.c.loader.WebappClassLoader - The web application [] appears to have started a thread named [New I/O worker #8] but has failed to stop it. This is very likely to create a memory leak.
2015-09-20 23:05:04.446 [localhost-startStop-2] [] ERROR o.a.c.loader.WebappClassLoader - The web application [] appears to have started a thread named [New I/O boss #9] but has failed to stop it. This is very likely to create a memory leak.
2015-09-20 23:05:04.446 [localhost-startStop-2] [] ERROR o.a.c.loader.WebappClassLoader - The web application [] appears to have started a thread named [Timer-0] but has failed to stop it. This is very likely to create a memory leak.
2015-09-20 23:05:04.447 [localhost-startStop-2] [] ERROR o.a.c.loader.WebappClassLoader - The web application [] created a ThreadLocal with key of type [com.yammer.metrics.stats.ThreadLocalRandom$1] (value [com.yammer.metrics.stats.ThreadLocalRandom$1@78aa124e]) and a value of type [com.yammer.metrics.stats.ThreadLocalRandom] (value [com.yammer.metrics.stats.ThreadLocalRandom@6597fcc5]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.

【问题讨论】:

  • 您有一个带有连接的打开会话工厂实例。然后你在没有关闭连接的情况下弯下服务器。所以网络服务器会破坏连接,这就是你看到这个警告的原因。
  • 更新:好像我打开了异步 http 客户端,但没有让整个事情关闭。

标签: java eclipse spring hibernate


【解决方案1】:

您应该使用ServletContextListener 来监听生命周期事件contextInitialized/contextDestroyed。示例见here

【讨论】:

  • 好吧,这个日志只有在将 Metrics 绑定为单例时才会出现: bind(DefaultWebappMetricsFilter.class).in(Singleton.class); filter("/*").through(DefaultWebappMetricsFilter.class);来自 yammer (2.2.0) 的指标
猜你喜欢
  • 2012-09-24
  • 2014-04-19
  • 2011-07-21
  • 1970-01-01
  • 2017-08-31
  • 1970-01-01
  • 1970-01-01
  • 2011-02-18
  • 2016-02-21
相关资源
最近更新 更多