-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Describe the bug
Running a ServiceBusProcessorClient with #sessionProcessor is potentially leaking when there are no messages produced on the queue.
Same symptoms as #44228.
Exception or Stack Trace
N/A
To Reproduce
Run the following snippet for an extended period of time, observe Heap usage:
ServiceBusProcessorClient processorClient = new ServiceBusClientBuilder()
.connectionString(URL)
.sessionProcessor()
.maxConcurrentSessions(200)
.maxConcurrentCalls(1)
.sessionIdleTimeout(Duration.ofMillis(500))
.queueName(QUEUE_NAME)
.processMessage(m -> {})
.processError(e -> e.getException().printStackTrace())
.buildProcessorClient();
processorClient.start();
try {
while (true) { }
} catch (Exception e) {
e.printStackTrace();
} finally {
processorClient.close();
}Code Snippet
See above.
Expected behavior
Stable heap usage with objects properly released.
Screenshots
N/A
Setup (please complete the following information):
- OS: Windows 11/Ubuntu 22.04
- IDE: IntelliJ
- Library/Libraries: com.azure:azure-messaging-servicebus:7.17.16
- Java version: 11
- App Server/Environment: Tomcat
- Frameworks: Spring 4.x
Additional context
We noticed this while the consumers are idle, i.e. no messages produced on the queue. However, this prevents us from switching to Service Bus confidently, since we see an increased heap usage when the listeners aren't active with the possibility of a leak. As I mentioned,
Our use-case is a high throughput queue (thousands of messages per minute) with guaranteed FIFO processing. This was already reported back in February by another user, see #44228.
Information Checklist
- Bug Description Added
- Repro Steps Added
- Setup information Added