Hello all,
I am currently using BaseX in embedded mode as a XQuery processor in a tomcat webapplication. I am receiving some XML, create a BaseX in memory database, execute some XQuery, then close the context.
But when I stop tomcat or reload the web application, I have a lot of errors saying:
SEVERE [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [webap] created a ThreadLocal with key of type [java.lang.ThreadLocal.SuppliedThreadLocal] (value [java.lang.ThreadLocal$SuppliedThreadLocal@60506a99]) and a value of type [org.basex.query.expr.path.PathCache] (value [org.basex.query.expr.path.PathCache@665cfafa]) 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.
Is there a way to avoid that error, by forcibly clearing these cache or something ?
Thanks
Simon
Hi Simon,
Thanks for your observations.
PathCache instances should be cleaned up automatically once a thread is closed, but I’ll try to find cases in which this doesn’t work as expected [1].
Did you encounter increased memory consumption when running Tomcat for a longer time (which might indicate a real memory leak), or is it just the message that was confusing? Do all of the errors point to the PathCache class, or also to other BaseX Java classes?
Best Christian
[1] https://github.com/BaseXdb/basex/issues/1617
On Tue, Aug 28, 2018 at 10:14 AM Simon Chatelain schatela@gmail.com wrote:
Hello all,
I am currently using BaseX in embedded mode as a XQuery processor in a tomcat webapplication. I am receiving some XML, create a BaseX in memory database, execute some XQuery, then close the context.
But when I stop tomcat or reload the web application, I have a lot of errors saying:
SEVERE [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [webap] created a ThreadLocal with key of type [java.lang.ThreadLocal.SuppliedThreadLocal] (value [java.lang.ThreadLocal$SuppliedThreadLocal@60506a99]) and a value of type [org.basex.query.expr.path.PathCache] (value [org.basex.query.expr.path.PathCache@665cfafa]) 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.
Is there a way to avoid that error, by forcibly clearing these cache or something ?
Thanks
Simon
Hi Simon,
I tried to make the ThreadLocal cleanups more explicit in our code. Thread-specific caches should now be invalidated after query evaluation, even if a servlet request may reside in a thread pool (which may be the case in Tomcat).
It would be marvellous if you could test the latest stable snapshot [1] and come back to us with an updated report. If the problem persists, I’ll be glad to have a look at the full Tomcat error list.
Cheers Christian
[1] http://files.basex.org/releases/latest/
On Tue, Aug 28, 2018 at 10:14 AM Simon Chatelain schatela@gmail.com wrote:
Hello all,
I am currently using BaseX in embedded mode as a XQuery processor in a tomcat webapplication. I am receiving some XML, create a BaseX in memory database, execute some XQuery, then close the context.
But when I stop tomcat or reload the web application, I have a lot of errors saying:
SEVERE [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [webap] created a ThreadLocal with key of type [java.lang.ThreadLocal.SuppliedThreadLocal] (value [java.lang.ThreadLocal$SuppliedThreadLocal@60506a99]) and a value of type [org.basex.query.expr.path.PathCache] (value [org.basex.query.expr.path.PathCache@665cfafa]) 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.
Is there a way to avoid that error, by forcibly clearing these cache or something ?
Thanks
Simon
basex-talk@mailman.uni-konstanz.de