orientechnologies / orientechnologies/orientdb
ThreadLocal vars leak on Tomcat
Open
@andrii0lomakin is already working on this.
Since Jun 26, 2021.
- Dominant language
- Java
- Stars
- 5k
- Forks
- 868
- Avg merge
- 15h 6m
- Merged PRs (30d)
- 18
Description
OrientDB Version: 3.1.9
Java Version: JDK8
OS: OSX
When working with embedded DB with Tomcat 8 on finish I have plenty of such records.
15-Mar-2021 13:51:28.673 SEVERE [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [ROOT] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@4801cdd1]) and a value of type [com.orientechnologies.common.concur.lock.ScalableRWLock.ReadersEntry] (value [com.orientechnologies.common.concur.lock.ScalableRWLock$ReadersEntry@21790418]) 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.
after 5 min waiting i got
15-Mar-2021 13:52:22.743 INFO [Timer-22] org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading Illegal access: this web application instance has been stopped already. Could not load [com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap$Values]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap$Values]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1378)
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1366)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1218)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1180)
at com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap.values(ConcurrentLinkedHashMap.java:954)
at com.orientechnologies.orient.core.db.OCachedDatabasePoolFactoryImpl.cleanUpCache(OCachedDatabasePoolFactoryImpl.java:67)
at com.orientechnologies.orient.core.db.OCachedDatabasePoolFactoryImpl.access$100(OCachedDatabasePoolFactoryImpl.java:21)
at com.orientechnologies.orient.core.db.OCachedDatabasePoolFactoryImpl$1.run(OCachedDatabasePoolFactoryImpl.java:59)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
Exception in thread "Timer-22" java.lang.NoClassDefFoundError: com/googlecode/concurrentlinkedhashmap/ConcurrentLinkedHashMap$Values
at com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap.values(ConcurrentLinkedHashMap.java:954)
at com.orientechnologies.orient.core.db.OCachedDatabasePoolFactoryImpl.cleanUpCache(OCachedDatabasePoolFactoryImpl.java:67)
at com.orientechnologies.orient.core.db.OCachedDatabasePoolFactoryImpl.access$100(OCachedDatabasePoolFactoryImpl.java:21)
at com.orientechnologies.orient.core.db.OCachedDatabasePoolFactoryImpl$1.run(OCachedDatabasePoolFactoryImpl.java:59)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
Caused by: java.lang.ClassNotFoundException: Illegal access: this web application instance has been stopped already. Could not load [com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap$Values]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1368)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1218)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1180)
... 6 more
Caused by: java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap$Values]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1378)
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1366)
... 8 more
Thanks
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.