azure-service-bus-java icon indicating copy to clipboard operation
azure-service-bus-java copied to clipboard

Memory leak regarding threads started by SubscriptionClient

Open MStumpp opened this issue 6 years ago • 1 comments

Describe the bug When undeploying a Tomcat8 application (war), Tomcat warns about a memory leak regarding threads which could not be stopped. It happens even SubscriptionClient.close() is called.

To Reproduce Create a war application, which set up a SubscriptionClient and registers a MessageHandler and configures n (128 in my case) concurrent calls (MessageHandlerOptions).

Code can be taken from: https://github.com/Azure/azure-service-bus/blob/master/samples/Java/azure-servicebus/TopicsGettingStarted/src/main/java/com/microsoft/azure/servicebus/samples/topicsgettingstarted/TopicsGettingStarted.java

Expected behavior All threads started by Azure Service Bus lib are terminated when calling SubscriptionClient.close(). No warnings are shown.

Observed behavior org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [...] appears to have started a thread named [...] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:

Environment (please complete the following information):

  • Ubuntu
  • Azure Service Bus lib: <groupId>com.microsoft.azure</groupId> <artifactId>azure-servicebus</artifactId> 1.2.8

MStumpp avatar Jan 05 '19 00:01 MStumpp

what is the name of the thread? That may help me identify the issue, without having to deploy a sample application to a web server.

yvgopal avatar Jan 08 '19 01:01 yvgopal