michaelandrepearce commented on a change in pull request #2517: [ARTEMIS-2171]: ThreadPoolExecutor leak under SM due to lack of privileged block. URL: https://github.com/apache/activemq-artemis/pull/2517#discussion_r250701848
########## File path: artemis-commons/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQScheduledComponent.java ########## @@ -153,7 +153,12 @@ public synchronized void start() { } protected ActiveMQThreadFactory getThreadFactory() { - return new ActiveMQThreadFactory(this.getClass().getSimpleName() + "-scheduled-threads", false, getThisClassLoader()); + return AccessController.doPrivileged(new PrivilegedAction<ActiveMQThreadFactory>() { + @Override + public ActiveMQThreadFactory run() { + return new ActiveMQThreadFactory(this.getClass().getSimpleName() + "-scheduled-threads", false, getThisClassLoader()); Review comment: Threads created by ActiveMQThreadFactory should be already created by doPrivileged. how are we sure its not just that the thread issues you are seeing are maybe just where code isn't using ActiveMQThreadFactory see in ActiveMQThreadFactory ``` @Override public Thread newThread(final Runnable command) { // create a thread in a privileged block if running with Security Manager if (acc != null) { return AccessController.doPrivileged(new ThreadCreateAction(command), acc); } else { return createThread(command); } } ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services