Azure / Azure/azure-service-bus-java

Memory leak regarding threads started by SubscriptionClient

Open
#319 1 comment 0 reactions 1 assignee Claimed by @yvgopal View on GitHub
question
Dominant language
Java
Stars
62
Forks
63
PR merge metrics
No merged PRs in 30d

Description

**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:
com.microsoft.azure
azure-servicebus
1.2.8

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.