Tomcat和ojdbc8 - 内存泄漏问题

时间:2017-10-12 18:03:14

标签: tomcat memory-leaks tomcat8 ojdbc

我在tomcat 8.0.44上部署了spring web应用程序。 Web应用程序使用的是Oracle ojdbc8驱动程序12.2.0.1版本。我的问题是,当我重新启动tomcat时,它无法阻止jdbc创建的theads,因此无法正常停止。当我在$ TOMCAT_HOME \ libs里面或者在war里面有ojdbc.jar时它会发生(但是在内部战争时,不同的线程不能停止)。

我知道2013年有一个已知的jdbc错误(错误号16841748),导致固定大小的内存泄漏。但我无法在oracle页面上找到有关修复此问题的任何信息,也无法找到有关解决方法的任何信息。这个问题有点烦人,因为在开发期间多次重启会产生多个java进程(参见2次重启的截图)

enter image description here

这是堆栈跟踪:

paź 12, 2017 6:31:38 PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
WARNING: The web application [signer] appears to have started a thread named [Timer-0] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 java.lang.Object.wait(Native Method)
 java.lang.Object.wait(Object.java:502)
 java.util.TimerThread.mainLoop(Timer.java:526)
 java.util.TimerThread.run(Timer.java:505)
paź 12, 2017 6:31:38 PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
WARNING: The web application [signer] appears to have started a thread named [oracle.jdbc.driver.BlockSource.ThreadedCachingBlockSource.BlockReleaser] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 java.lang.Object.wait(Native Method)
 oracle.jdbc.driver.BlockSource$ThreadedCachingBlockSource$BlockReleaser.run(BlockSource.java:329)
paź 12, 2017 6:31:38 PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
WARNING: The web application [signer] appears to have started a thread named [InterruptTimer] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 java.lang.Object.wait(Native Method)
 java.lang.Object.wait(Object.java:502)
 java.util.TimerThread.mainLoop(Timer.java:526)
 java.util.TimerThread.run(Timer.java:505)
paź 12, 2017 6:31:38 PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
WARNING: The web application [signer] appears to have started a thread named [pool-2-thread-1] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 sun.misc.Unsafe.park(Native Method)
 java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
 java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
 java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1093)
 java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809)
 java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
 java.lang.Thread.run(Thread.java:745)

我只在此tomcat上部署了单个应用程序,并且任何其他应用程序都不使用jdbc驱动程序。我已经尝试过使用classloader-leak-prevention-servlet3,它确实检测到了这些线程,但它对tomcat重启没有帮助。我还尝试按名称搜索线程并在应用程序关闭期间手动停止它们(使用不推荐的停止方法),但是然后抛出一些异常并且它似乎不是一个好主意。我该如何解决这个问题?

0 个答案:

没有答案