[rabbitmq-discuss] Stuck waiting for frame during amqp_basic_qos?

David Wragg david at rabbitmq.com
Wed Nov 9 14:16:12 GMT 2011

Hi Pieter,

Pieter de Zwart <pdezwart at rubiconproject.com> writes:
> Thanks for the pointer. I fixed that particular item, but as predicted, it
> did not resolve the issue. With a fresh perspective I dug in some more,
> and figured out that the culprit was calling amqp_basic_ack when no
> message was consumed. Somehow that created the situation whereby the next
> call to amqp_basic_qos got stuck.

I had a go at reproducing this from C code, with no luck so far.  See

> If I write some very basic C code that replicates this behavior à la
> rabbitmq-c/examples, do you think you can help me figure out what the hell
> im doing wrong? =)

Yes please.

Another thing that might help understand the cause is to use the tracer
provuided with the rabbitmq java client to see what the client and
server are saying to each other.  See

Here's the relevant part of the tracer output for my test program:

1320847892203: <Tracer-3> ch#1 -> {#method<basic.ack>(delivery-tag=666, multiple=false),null,""}
1320847892203: <Tracer-3> ch#0 -> {#method<basic.qos>(prefetch-size=0, prefetch-count=1, global=false),null,""}
1320847892241: <Tracer-3> ch#1 <- {#method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - unknown delivery tag 666, class-id=60, method-id=80),null,""}
1320847892242: <Tracer-3> ch#0 <- {#method<connection.close>(reply-code=504, reply-text=CHANNEL_ERROR - unexpected method in connection state running, class-id=60, method-id=10),null,""}


- My client program acks with a non-existent delivery tag.

- Before the server responds to that, the client sends the basic.qos

- Because of the delivery tag issue, the server sends a channel.close to
  signal the channel exception.

- The server now processes the basic.qos, and because the channel was in
  the wrong state (it is expecting a close-ok from the client), it
  signals a connection-level exception.

In my client program, the amqp_basic_qos call returns NULL when the
channel.close is received, to signal the error.  The details of that
error are available by calling amqp_get_rpc_reply on the connection.


David Wragg
Staff Engineer, RabbitMQ
VMware, Inc.

More information about the rabbitmq-discuss mailing list