-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Azure ServiceBus memory leak #42717
Comments
Thank you for your feedback. Tagging and routing to the team member best able to assist. |
Hello @gataricd, this is resolved recently, you can find more details here #41865 Note that you will still see the session disconnect/reconnect logs (which is expected) but the new version should address the NullPointerException. Please follow below steps - Update to 7.17.5 dependency<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-messaging-servicebus</artifactId>
<version>7.17.5</version>
</dependency> Update the ServiceBusClientBuilder for "com.azure.core.amqp.cache"When building any client (ServiceBusProcessorClient, ServiceBusReceiverClient, ServiceBusSenderClient etc..) use the configuration ("com.azure.core.amqp.cache"), as shown below. Make sure this configuration is selected for all the places where the application creates a new new ServiceBusClientBuilder()
.connectionString(queueProperties.connectionString())
.configuration(new ConfigurationBuilder()
.putProperty("com.azure.core.amqp.cache", "true")
.build())
.processor()
.queueName(queueName)
.processMessage(handler)
.processError { context -> processError(context) }
.maxConcurrentCalls(10)
.disableAutoComplete()
.maxAutoLockRenewDuration(Duration.ZERO)
.prefetchCount(0)
.buildProcessorClient() Choosing this configuration is important to resolve the problem - Ensure right transitive dependenciesMake sure the transitive dependencies (azure-core-amqp, azure-core) are resolved to expected versions.
Note: In the upcoming version the need for opt-in "com.azure.core.amqp.cache" will be removed |
Hi @gataricd. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text "/unresolve" to remove the "issue-addressed" label and continue the conversation. |
/unresolve |
Describe the bug
The number of
ServiceBusReactorAmqpConnection
instances is rising until there is no more memory on the heap. When the app is started the number of instances is 44, because we use 44 queues, but with time it rises to above 500 and eventually we get OutOfMemoryError. The heap size is limited to around 500 MB.When the OutOfMemoryError happens, all the ServiceBusReactorAmqpConnection have sessionMap set to 0. This lead us to conclusion that garbage collector is not cleaning these connections that are not being used.
We have never had similar problem before and it happens during normal load.
Exception or Stack Trace
The following exceptions might be relevant to the problem:
and
These exceptions started ocurring when we switched from 7.17.1 to 7.17.3.
To Reproduce
There are no special steps to reproduce.
Code Snippet
The following code is executed for every queue:
Expected behavior
The memory consumption of the service bus library shouldn't raise to the point that cause OutOfMemoryError.
Setup (please complete the following information):
OS: Linux
Library/Libraries: com.azure:azure-messaging-servicebus:7.17.3
Java version: 21
App Server/Environment: AKS
Frameworks: Sprint Boot
The text was updated successfully, but these errors were encountered: