We have a warning with regards IllegalReflectiveAccess in BrokerPool on Java 9+.
This comes about due to BrokerPoool#cleanThreadLocalsForThread(Thread) which uses reflection to manually clear out thread-locals. This code was added as we seemed to have a problem with some ThreadLocals never being cleared, which prohibited a clean shutdown when running eXist-db inside a Servlet Container such as Tomcat.
If we fix those issues, we could drop BrokerPoool#cleanThreadLocalsForThread(Thread).
The first thing that needs to be examined is org.exist.collections.triggers.TriggerStatePerThread. I don't quite understand why it is needed at the moment. It seems completely superfluous. The second thing that needs examining are ByteArrayPool and it's friends, which also use ThreadLocal.
We have a warning with regards
IllegalReflectiveAccess
inBrokerPool
on Java 9+.This comes about due to
BrokerPoool#cleanThreadLocalsForThread(Thread)
which uses reflection to manually clear out thread-locals. This code was added as we seemed to have a problem with some ThreadLocals never being cleared, which prohibited a clean shutdown when running eXist-db inside a Servlet Container such as Tomcat.I suspect, the real cause of the
ThreadLocal
leak is potentially anywhere where we have used ThreadLocal from a DBBroker (which is a reused Thread). See - https://www.javaspecialists.eu/archive/Issue229.htmlIf we fix those issues, we could drop
BrokerPoool#cleanThreadLocalsForThread(Thread)
.The first thing that needs to be examined is
org.exist.collections.triggers.TriggerStatePerThread
. I don't quite understand why it is needed at the moment. It seems completely superfluous. The second thing that needs examining areByteArrayPool
and it's friends, which also useThreadLocal
.