Steps to Reproduce
Start a ZK webapp in tomcat 9 with websockets enabled
do a few actions
turn off tomcat using catalina stop command
Current Result
Exception (below), server doesn't stop the thread created to handle the websockets
Expected Result
Server gracefully stops
Debug Information
25-Feb-2022 18:48:36.074 WARNING [main] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [APP NAME HERE] 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:1074) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) java.lang.Thread.run(Thread.java:748)
zk.xml config sample <listener> <listener-class>org.zkoss.zkmax.au.websocket.WebSocketWebAppInit</listener-class> </listener> <library-property> <name>org.zkoss.zkmax.au.websocket.WebSocketEndPoint.reconnectionAttempts</name> <value>10000</value> </library-property> <library-property> <name>org.zkoss.zkmax.au.websocket.WebSocketEndPoint.pingIntervalSecond</name> <value>2</value> </library-property> <session-config> <timer-keep-alive>false</timer-keep-alive> <max-desktops-per-session>15</max-desktops-per-session> <max-requests-per-session>5</max-requests-per-session> </session-config>
Workaround