Bug 56907

Summary: Threads leak
Product: Tomcat 8 Reporter: gaponenkov
Component: WebSocketAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 8.0.11   
Target Milestone: ----   
Hardware: PC   
OS: All   

Description gaponenkov 2014-09-02 07:40:48 UTC
Hello.

While using WebSocket implementation of versions 7.0.55 and 8.0.11 leaking threads were noticed. 
Use method WsWebSocketContainer.connection (endpoint, clientEndpointConfiguration, path) to reproduce this issue. 
The URL to specify a non-existent page. As a result, the connection will return an error "404 Not Found", but the threads that have been created in the class AsyncChannelWrapperSecure will stay alive for a long time (source of threads creation: private final ExecutorService executor = Executors.newFixedThreadPool (2, new SecureIOThreadFactory ());). 
Count of threads are increasing with every reconnect attempt to non-existent URL.
Those will live for a very long time, until you disable the application that calls the connection WsWebSocketContainer.connection (...). 
Leakage threads can be observed using the jvisualvm program. 

Please, make it possible to deal with such kind of situations and destroy unused threads.
Comment 1 Mark Thomas 2014-09-03 12:22:37 UTC
Thanks for the report.

This has been fixed in 8.0.x for 8.0.13 onwards and in 7.0.x for 7.0.56 onwards.