AMQConnection hangs when disconnecting

117 views
Skip to first unread message

David Moxon

unread,
Oct 10, 2017, 7:57:19 AM10/10/17
to rabbitmq-users
We are experiencing an intermittent issue with our Java application which uses the amqp-client-4.1.1 library to connect to our centrally-hosted RabbitMQ server.

Occasionally we find that one of our connection threads is hanging. A thread dump at the time indicates that this thread is waiting within the AMQP Java library. **THIS THREAD NEVER CONTINUES**.

We have set up pro-active monitoring to ensure we catch this scenario, and have to restart our application to recover the hanging thread, which is not a desirable solution.

Relevant stack trace of this thread is as follows:

"Flash Channel Manager" - Thread t@109
java.lang.Thread.State: WAITING
at java.lang.Object.wait(Native Method)
- waiting on <5cee4d61> (a com.rabbitmq.utility.BlockingValueOrException)
at java.lang.Object.wait(Object.java:502)
at com.rabbitmq.utility.BlockingCell.get(BlockingCell.java:49)
at com.rabbitmq.utility.BlockingCell.get(BlockingCell.java:64)
at com.rabbitmq.utility.BlockingCell.uninterruptibleGet(BlockingCell.java:120)
at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:36)
at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:412)
at com.rabbitmq.client.impl.AMQConnection.close(AMQConnection.java:999)
at com.rabbitmq.client.impl.AMQConnection.close(AMQConnection.java:918)
at com.rabbitmq.client.impl.AMQConnection.close(AMQConnection.java:902)
at com.rabbitmq.client.impl.AMQConnection.close(AMQConnection.java:894)
at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.close(AutorecoveringConnection.java:216)
at com.touch.clarity.go.app.flash.messaging.channels.FlashChannel.disconnect(FlashChannel.java:429)
at com.touch.clarity.go.app.flash.messaging.channels.FlashChannel.connect(FlashChannel.java:391)
- locked <550e9de> (a com.touch.clarity.go.app.flash.messaging.channels.FlashChannel)
at com.touch.clarity.go.app.flash.messaging.channels.FlashChannel.connect(FlashChannel.java:379)
at com.touch.clarity.go.app.flash.messaging.channels.FlashManager$ChannelManager.run(FlashManager.java:393)
- locked <3fd8b36e> (a java.util.HashMap)

Arnaud Cogoluègnes

unread,
Oct 10, 2017, 8:11:47 AM10/10/17
to rabbitm...@googlegroups.com
Use the Connection#close(timeoutInMs) method. You should still get an exception, but there shouldn't be any hanging thread anymore. Upgrade also to Java Client 4.2.2, it's backward compatible.

--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

David Moxon

unread,
Oct 17, 2017, 11:54:34 AM10/17/17
to rabbitmq-users
Excellent, Thanks for the response! That makes a lot of sense now I'm looking at it, presumably the method I'm calling will never timeout, hence the hanging thread.

Will try this, and upgrade to 4.2.2 and potentially even 5.0.

Many thanks
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages