title: Tomcat and ojdbc8 - memory leak issue
body: <p>I have spring web application deployed on tomcat 8.0.44. Web application is using Oracle ojdbc8 driver 12.2.0.1 version. My problem is that when i restart tomcat it is not able to stop theads created by jdbc and thus not able to stop properly. It happens both when i have ojdbc.jar inside $TOMCAT_HOME\libs or inside war (but when inside war different threads cant be stopped). </p>
  
  <p>I know there was a known bug with jdbc back in 2013 (bug id 16841748), which causes a fixed size memory leak. But i cant find any information on oracle page about fixing this problem nor any info about workaround. This problem is kind of annoying as with multiple restarts during development multiple java processes are spawned (see screenshot with 2 restarts)</p>
  
  <p><a href="https://i.stack.imgur.com/OZEQV.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OZEQV.jpg" alt="enter image description here"></a></p>
  
  <p>Here is the stack trace:</p>
  
  <pre><code>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)
  </code></pre>
  
  <p>I have only single application deployed on this tomcat and jdbc driver is not used by any other application. I have already tried using classloader-leak-prevention-servlet3, which does detect these threads but it does not help with tomcat restarts. I also tried to search threads by name and manually stop them (using deprecated stop method) during application shutdown, but then some exception are thrown and it doesnt seem like a good idea. How can i fix this?</p>