QiuYucheng2003 opened a new issue, #6554:
URL: https://github.com/apache/incubator-kie-drools/issues/6554
Description
The ExecutorProviderImpl class initializes a static ExecutorService within
the ExecutorHolder inner class but provides no mechanism to shut it down.
Root Cause
1. Static Holder: The executor is defined as private static final in
ExecutorHolder.
2. No Termination: There is no public API (e.g., a shutdown() method)
exposed to terminate this thread pool.
3. Daemon Threads Insufficient: While DaemonThreadFactory is used, it does
not prevent leaks in containerized environments (like Tomcat or OSGi). When the
application is redeployed, the JVM keeps running, so the daemon threads remain
alive.
Impact
In a Servlet container or dynamic module architecture, when the application
is undeployed or reloaded:
·The worker threads in the static pool do not stop.
·These threads hold references to the ContextClassLoader.
·This prevents the old ClassLoader from being garbage collected.
·Result: Eventually causes Metaspace OutOfMemoryError after multiple
redeployments.
Relevant Code
File: org/drools/core/concurrent/ExecutorProviderImpl.java
private static class ExecutorHolder {
private static final ExecutorService executor; // Static reference
static {
// ... initialization ...
executor = newExecutor;
}
}
// Missing shutdown logic
Suggested Fix
Provide a lifecycle management method to explicitly shut down the
ExecutorService when the Drools service/container is stopped.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]