0

We are using Apache Qpid JMS Client(0.45) to consume messages from ServiceBus. We are getting Suspected deadlocked threads while restarting of connection. After log investigation, we realized that JmsSession was not closed properly. While closing JmsSession - we received Illegal invocation from MessageListener callback error. It could be a reason for thread blocking.

If we received an exception while closing JMS Connection/Session/Consumer, then how can we close and clean up properly from system?

I reset JMS object after closing such as Connection = null, MessageConsumer=null; Session = null;. I think this is not working properly as some Threads are still open in System.

Could anyone please suggest any idea to clean and close JMS object properly from System?

Sample deadlock log

Suspected deadlocked threads: JmsSession [ID:7086e194-aaec-4b41-cde1-fd680526e07a:1:12] delivery dispatcher Id=201 is in WAITING on lock=java.util.concurrent.locks.ReentrantLock$NonfairSync@20af281a
is owned by JmsSession [ID:7086e194-aaec-4b41-cde1-fd680526e07a:1:10] delivery dispatcher Id=199 | JmsSession [ID:7086e194-aaec-4b41-cde1-fd680526e07a:1:10] delivery dispatcher Id=199 is in BLOCKED on lock=org.mule.transport.Servicebus@778245e1
is owned by JmsSession [ID:7086e194-aaec-4b41-cde1-fd680526e07a:1:12] delivery dispatcher Id=201 | "

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Abhishek Kumar
  • 435
  • 1
  • 6
  • 16

1 Answers1

2

As per the JMS specification calling Connection.close() will close all client resources and shutdown all client threads once the close completes. There isn't a need to close each individual resource unless you are doing something to try and recreate a failed consumer or producer but in the end it is hard to tell from the generic JMS exceptions what has gone wrong so you likely will end up closing the connection and starting over as the most robust means of error recovery.

You are using a rather old JMS client version as the latest is 0.55.0 with a 0.56.0 likely being released in a week or two. There are a number of fixes between where you are now and what's currently available so you really should update before chasing after things that are likely fixed.

Tim Bish
  • 17,475
  • 4
  • 32
  • 42