Bug 56907 - Threads leak
Summary: Threads leak
Alias: None
Product: Tomcat 8
Classification: Unclassified
Component: WebSocket (show other bugs)
Version: 8.0.11
Hardware: PC All
: P2 normal (vote)
Target Milestone: ----
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2014-09-02 07:40 UTC by gaponenkov
Modified: 2014-09-03 12:22 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description gaponenkov 2014-09-02 07:40:48 UTC

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.