# The web application \[...\] appears to have started a thread named \[OkHttp \<tenant\>.auth0.com\] but has failed to stop it

**URL:** <https://community.auth0.com/t/the-web-application-appears-to-have-started-a-thread-named-okhttp-tenant-auth0-com-but-has-failed-to-stop-it/88035>\
**Category:** Get Help\
**Tags:** okhttp, java\
**Created:** [August 2, 2022, 4:05pm UTC](https://community.auth0.com/t/the-web-application-appears-to-have-started-a-thread-named-okhttp-tenant-auth0-com-but-has-failed-to-stop-it/88035 "2022-08-02T16:05:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![andy.nugent](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/andy.nugent/32/39109_2.png) [@andy.nugent](https://community.auth0.com/u/andy.nugent)\
**Post date:** [August 2, 2022, 4:05pm UTC](https://community.auth0.com/t/the-web-application-appears-to-have-started-a-thread-named-okhttp-tenant-auth0-com-but-has-failed-to-stop-it/88035/1 "2022-08-02T16:05:13Z")

</div>

Please include the following information in your post:

- Which SDK this is regarding: Java (com.auth0:auth0:1.42.0)
- SDK Version: 1.42.0
- Platform Version: Java 8

On shutdown of the web application there is numerous error messages regarding OkHttp threads not being stopped, causing a memory leak. Am I missing something, or is there no method for shutting down these threads?

Aug 02, 2022 4:52:28 PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads  
WARNING: The web application [] appears to have started a thread named [OkHttp Dispatcher] 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.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:460)  
java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:362)  
java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:941)  
java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1073)  
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)  
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)  
java.lang.Thread.run(Thread.java:750)  
Aug 02, 2022 4:52:28 PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads  
WARNING: The web application [] appears to have started a thread named [OkHttp .auth0.com] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:  
java.net.SocketInputStream.socketRead0(Native Method)  
java.net.SocketInputStream.socketRead(SocketInputStream.java:116)  
java.net.SocketInputStream.read(SocketInputStream.java:171)  
java.net.SocketInputStream.read(SocketInputStream.java:141)  
sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:475)  
sun.security.ssl.SSLSocketInputRecord.readHeader(SSLSocketInputRecord.java:469)  
sun.security.ssl.SSLSocketInputRecord.bytesInCompletePacket(SSLSocketInputRecord.java:69)  
sun.security.ssl.SSLSocketImpl.readApplicationRecord(SSLSocketImpl.java:1266)  
sun.security.ssl.SSLSocketImpl.access$300(SSLSocketImpl.java:76)  
sun.security.ssl.SSLSocketImpl$AppInputStream.read(SSLSocketImpl.java:943)  
okio.InputStreamSource.read(JvmOkio.kt:90)  
okio.AsyncTimeout$source$1.read(AsyncTimeout.kt:129)  
okio.RealBufferedSource.request(RealBufferedSource.kt:206)  
okio.RealBufferedSource.require(RealBufferedSource.kt:199)  
okhttp3.internal.http2.Http2Reader.nextFrame(Http2Reader.kt:89)  
okhttp3.internal.http2.Http2Connection$ReaderRunnable.invoke(Http2Connection.kt:618)  
okhttp3.internal.http2.Http2Connection$ReaderRunnable.invoke(Http2Connection.kt:609)  
okhttp3.internal.concurrent.TaskQueue$execute$1.runOnce(TaskQueue.kt:98)  
okhttp3.internal.concurrent.TaskRunner.runTask(TaskRunner.kt:116)  
okhttp3.internal.concurrent.TaskRunner.access$runTask(TaskRunner.kt:42)  
okhttp3.internal.concurrent.TaskRunner$runnable$1.run(TaskRunner.kt:65)  
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)  
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)  
java.lang.Thread.run(Thread.java:750)  
Aug 02, 2022 4:52:28 PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads  
WARNING: The web application [] appears to have started a thread named [OkHttp TaskRunner] 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:460)  
okhttp3.internal.concurrent.TaskRunner$RealBackend.coordinatorWait(TaskRunner.kt:294)  
okhttp3.internal.concurrent.TaskRunner.awaitTaskToRun(TaskRunner.kt:218)  
okhttp3.internal.concurrent.TaskRunner$runnable$1.run(TaskRunner.kt:59)  
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)  
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)  
java.lang.Thread.run(Thread.java:750)  
Aug 02, 2022 4:52:28 PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads  
WARNING: The web application [] appears to have started a thread named [OkHttp TaskRunner] 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.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:460)  
java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:362)  
java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:941)  
java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1073)  
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)  
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)  
java.lang.Thread.run(Thread.java:750)  
Aug 02, 2022 4:52:28 PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads  
WARNING: The web application [] appears to have started a thread named [OkHttp TaskRunner] 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.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:460)  
java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:362)  
java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:941)  
java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1073)  
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)  
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)  
java.lang.Thread.run(Thread.java:750)  
Aug 02, 2022 4:52:28 PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads  
WARNING: The web application [] appears to have started a thread named [Okio Watchdog] 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)  
okio.AsyncTimeout$Companion.awaitTimeout$okio(AsyncTimeout.kt:300)  
okio.AsyncTimeout$Watchdog.run(AsyncTimeout.kt:187)

---

<div class="post-metadata">

**Author:** ![marcelina.barycka](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/marcelina.barycka/32/56162_2.png) [@marcelina.barycka](https://community.auth0.com/u/marcelina.barycka)\
**Post date:** [May 17, 2024, 1:15pm UTC](https://community.auth0.com/t/the-web-application-appears-to-have-started-a-thread-named-okhttp-tenant-auth0-com-but-has-failed-to-stop-it/88035/2 "2024-05-17T13:15:23Z")

</div>

Apologies for bumping it up - we are doing our backlog clean-up, so I thought I would update this topic with the discussion thread on our GitHub Issues page. You may find there references for the problem resolution:

- [Tomcat is not able to stop because of "OkHttp ConnectionPool" and "Okio Watchdog" threads · Issue #5542 · square/okhttp · GitHub](https://github.com/square/okhttp/issues/5542)
- [TaskRunner tracking bug · Issue #5512 · square/okhttp · GitHub](https://github.com/square/okhttp/issues/5512)
- [Upgrade OkHttp dependency to 4.3+ · Issue #23 · duosecurity/duo\_universal\_java · GitHub](https://github.com/duosecurity/duo_universal_java/issues/23)

Warm regards,  
Marcelina

---

<div class="post-metadata">

**Author:** ![marcelina.barycka](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/marcelina.barycka/32/56162_2.png) [@marcelina.barycka](https://community.auth0.com/u/marcelina.barycka)\
**Post date:** [May 17, 2024, 1:15pm UTC](https://community.auth0.com/t/the-web-application-appears-to-have-started-a-thread-named-okhttp-tenant-auth0-com-but-has-failed-to-stop-it/88035/3 "2024-05-17T13:15:28Z")

</div>


