Skip to content

DMLC: JMS resources are never cleared under certain conditions [SPR-10092] #14725

@spring-projects-issues

Description

@spring-projects-issues

Raul Kripalani opened SPR-10092 and commented

JMS Resources (Sessions & MessageConsumers) associated with a AsyncMessageListenerInvoker are never closed and disposed if:

  • you're using a defined maxMessagesPerTask, i.e. >= 0
  • you first stop the DMLC and then destroy it

This is what happens:

  • the call to stop() sets running = false
  • invokers whose receiveTimeout elapses will notice this, but because AbstractJmsListeningContainer.active is still = true, they will pause (see logic in AbstractJmsListeningContainer#rescheduleTaskIfNecessary)
  • when you call destroy(), the pausedTasks are never dealt with, so they remain holding the JMS resources forever.

To reproduce easily, set a very low receiveTimeout, e.g. 10 ms.

This is a dangerous bug. Not only does it provoke a memory leak at both the client and the broker, but the broker can keep delivering messages to the client because the underlying MessageConsumer is left open forever.


Affects: 3.0.7

Referenced from: commits cc11b81, 6b3284f

Backported to: 3.1.4

Metadata

Metadata

Assignees

Labels

in: messagingIssues in messaging modules (jms, messaging)status: backportedAn issue that has been backported to maintenance branchestype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions