Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Reactor2TcpClient leaks threads on shutdown [SPR-14229] #18803
When using the StompBrokerRelayMessageHandler in a container (e.g. tomcat) it seems the shutdown sequence leaks threads.
In order to reproduce, you can switch the spring-websocket-portfolio webapp to use a StompBrokerRelay with rabbitmq. Loading the webapp in tomcat, logging in and then unloading the app again shows the issue.
Reference URL: https://github.com/rstoyanchev/spring-websocket-portfolio/
Roel Rymenants commented
AFAIK using the broker relay requires the usage of Reactor, no?
I used the spring-websocket-project to demonstrate this issue in order for dependencies etc to be clear. The only thing changed from the master branch was switching from the SimpMessageBroker to the broker relay in the config.
Rossen Stoyanchev commented
I've pushed a fix to shutdown the Environment which I verified locally. It will be available as 4.3.0.BUILD-SNAPSHOT or 4.2.6.BUILD-SNAPSHOT when the current build completes.
That may fix your case. Note however that there are more issues and I've created two Reactor tickets (see #623 and #624). The issue occurs especially if a reconnect is triggered while the server is still running (e.g. Rabbit goes down and then up). In any case expect a Reactor 2.0.9 release relatively soon. You can watch those tickets for when the fix becomes available to test.