[rabbitmq-discuss] Java client 2.1.0 deadlock

mabrek mabrek at gmail.com
Tue Oct 12 15:03:33 BST 2010


Hello.
I've got reproducible deadlock while working with java client 2.1.0.

Steps to follow:
1) create connection
2) create several threads that use single connection from step 1. Each
thread does:
2.1) create channel
2.2) consumes from non-existing queue
3) run all threads in parallel.
It will hang up.

One thread holds lock on ChannelManager:
"pool-1-thread-3" prio=10 tid=0x00007f74640e2000 nid=0x4667 in
Object.wait() [0x00007f7463ffe000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	- waiting on <0x00007f747339bbe8> (a
com.rabbitmq.utility.BlockingValueOrException)
	at java.lang.Object.wait(Object.java:485)
	at com.rabbitmq.utility.BlockingCell.get(BlockingCell.java:64)
	- locked <0x00007f747339bbe8> (a com.rabbitmq.utility.BlockingValueOrException)
	at com.rabbitmq.utility.BlockingCell.uninterruptibleGet(BlockingCell.java:103)
	- locked <0x00007f747339bbe8> (a com.rabbitmq.utility.BlockingValueOrException)
	at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:47)
	at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:342)
	at com.rabbitmq.client.impl.AMQChannel.rpc(AMQChannel.java:215)
	at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:139)
	at com.rabbitmq.client.impl.ChannelN.open(ChannelN.java:125)
	at com.rabbitmq.client.impl.ChannelManager.createChannelInternal(ChannelManager.java:121)
	- locked <0x00007f7473af80c8> (a com.rabbitmq.client.impl.ChannelManager)
	at com.rabbitmq.client.impl.ChannelManager.createChannel(ChannelManager.java:100)
	- locked <0x00007f7473af80c8> (a com.rabbitmq.client.impl.ChannelManager)
	at com.rabbitmq.client.impl.AMQConnection.createChannel(AMQConnection.java:382)

AMQP connection waits for this lock to handle Channel.Close(NOT_FOUND)
"AMQP Connection localhost:5672" prio=10 tid=0x00007f7464287800
nid=0x4675 waiting for monitor entry [0x00007f74631f0000]
   java.lang.Thread.State: BLOCKED (on object monitor)
	at com.rabbitmq.client.impl.ChannelManager.disconnectChannel(ChannelManager.java:135)
	- waiting to lock <0x00007f7473af80c8> (a
com.rabbitmq.client.impl.ChannelManager)
	at com.rabbitmq.client.impl.AMQConnection.disconnectChannel(AMQConnection.java:130)
	at com.rabbitmq.client.impl.ChannelN.releaseChannelNumber(ChannelN.java:205)
	at com.rabbitmq.client.impl.ChannelN.processAsync(ChannelN.java:229)
	at com.rabbitmq.client.impl.AMQChannel.handleCompleteInboundCommand(AMQChannel.java:165)
	at com.rabbitmq.client.impl.AMQChannel.handleFrame(AMQChannel.java:110)
	at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:434)
   Locked ownable synchronizers:
	- None

All other threads wait for this lock:
"pool-6-thread-1" prio=10 tid=0x00007f74642d4800 nid=0x4698 waiting
for monitor entry [0x00007f7460ecd000]
   java.lang.Thread.State: BLOCKED (on object monitor)
	at com.rabbitmq.client.impl.ChannelManager.createChannel(ChannelManager.java:96)
	- waiting to lock <0x00007f7473af80c8> (a
com.rabbitmq.client.impl.ChannelManager)
	at com.rabbitmq.client.impl.AMQConnection.createChannel(AMQConnection.java:382)

It looks like something was done around this issue at branch bug22064,
but it haven't merged into default yet and it's quite old. Do you have
any plans to use more fine grained locking in ChannelManager?

Regards,
Anton Lebedevich.


More information about the rabbitmq-discuss mailing list