Problems shutting down Lucee (due to running threads)

Hi all,

I recently started to migrate applications from Railo to Lucee and have
some problems shutting down the server (using shutdown.sh)

Environment:
OS X, Apache, 2 additional virtual hosts configured in apache (and in
Railo/Lucee)

Before:
Railo Express 4.2.1.008 (with Jetty 7.2)

After:
Lucee Express 4.5.1.008 (with Tomcat)

The application uses the cfconcurrent framework/library (wrapping java
concurrency) and runs some threads (more precisely a
ScheduledThreadPoolExecutor). Those threads where stopped onApplicationEnd
which worked fine on Railo/Jetty.
But now on Lucee/Tomcat I have problems shutting down the application
server. The threads continue to run.

I wonder whether this has something to do with the fact that it’s now
tomcat instead of jetty (my guess), or that Lucee does something
differently that Railo (which I doubt right now).
To cross-check I will change the environment to use Lucee/Jetty. But later
for production use I want to switch to tomcat so the problem remains.

Specifically this part of catalina.out looks odd:

01-Apr-2015 14:39:47.020 WARNING [hwsmailservice.lucee.local-startStop-2]
org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The
web application [ROOT] appears to have started a thread named
[pool-3-thread-1] but has failed to stop it. This is very likely to create
a memory leak. Stack trace of thread:
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1093)
java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809)
java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
java.lang.Thread.run(Thread.java:745)
01-Apr-2015 14:39:47.020 WARNING [hwsmailservice.lucee.local-startStop-2]
org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The
web application [ROOT] appears to have started a thread named
[pool-1-thread-1] but has failed to stop it. This is very likely to create
a memory leak. Stack trace of thread:
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
java.lang.Thread.run(Thread.java:745)

Any thoughts or suggestions what I am doing wrong or why tomcat seems to
handle this differently than Jetty?
Help is very much appreciated.

Best regards,
Jan

This is only with Tomcat no matter you’re using ACF, Railo or Lucee. I
don’t know why Tomcat does that when shutdown :(On Wednesday, April 1, 2015 at 2:48:45 PM UTC+2, Jan Jannek wrote:

Hi all,

I recently started to migrate applications from Railo to Lucee and have
some problems shutting down the server (using shutdown.sh)

Environment:
OS X, Apache, 2 additional virtual hosts configured in apache (and in
Railo/Lucee)

Before:
Railo Express 4.2.1.008 (with Jetty 7.2)

After:
Lucee Express 4.5.1.008 (with Tomcat)

The application uses the cfconcurrent framework/library (wrapping java
concurrency) and runs some threads (more precisely a
ScheduledThreadPoolExecutor). Those threads where stopped onApplicationEnd
which worked fine on Railo/Jetty.
But now on Lucee/Tomcat I have problems shutting down the application
server. The threads continue to run.

I wonder whether this has something to do with the fact that it’s now
tomcat instead of jetty (my guess), or that Lucee does something
differently that Railo (which I doubt right now).
To cross-check I will change the environment to use Lucee/Jetty. But later
for production use I want to switch to tomcat so the problem remains.

Specifically this part of catalina.out looks odd:

01-Apr-2015 14:39:47.020 WARNING [hwsmailservice.lucee.local-startStop-2]
org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The
web application [ROOT] appears to have started a thread named
[pool-3-thread-1] but has failed to stop it. This is very likely to create
a memory leak. Stack trace of thread:
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)

java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)

java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1093)

java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809)

java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)

java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)

java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
java.lang.Thread.run(Thread.java:745)
01-Apr-2015 14:39:47.020 WARNING [hwsmailservice.lucee.local-startStop-2]
org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The
web application [ROOT] appears to have started a thread named
[pool-1-thread-1] but has failed to stop it. This is very likely to create
a memory leak. Stack trace of thread:
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)

java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)

java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)

java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)

java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)

java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
java.lang.Thread.run(Thread.java:745)

Any thoughts or suggestions what I am doing wrong or why tomcat seems to
handle this differently than Jetty?
Help is very much appreciated.

Best regards,
Jan