Hmm... I think I follow you. I'm correct thinking that AMQPcpp is maintained by someone not associated with VMWare/RabbitMQ?

Regardless, thanks for your work looking into this issue.

Clint
On Jul 26, 2011, at 10:13 AM, David Wragg wrote:

Hi Clint,

Clint Miller <clint at rtcreativegroup.com> writes:
OK, here's the basic example. It shows how the basic.consume method of
the C++ library is not functioning correctly, but the basic.get works
correctly.

There's a basic Makefile that will probably require a little tweaking to get it working. It also depends on the 2 following libraries:

- RabbitMQ-C (from the official repository, I built it at rev/changeset ef4df46cc0db)
- AMQPcpp (from https://github.com/akalend/amqpcpp.git I built it at
rev/changeset 80b17375f5bed6965acc07477499285b6851c92f)
Thanks, I got it building quite easily. I'm not sure if I'm able to
reproduce the problem that you described in your original mail, but I
can confirm that it doesn't work for me.

This isn't primarily due to the use of librabbitmq in amqpcpp. That
looks basically sound (there are some calls to amqp_release_buffers in
AMQPQueue.cpp that should be amqp_maybe_release_buffers, but otherwise I
haven't found anything specifically wrong).

But when I run the program, it aborts. Running it inside gdb, I get
double free errors reported. So I ran it under valgrind. And valgrind
finds many problems in amqpcpp. (In fairness, it also complains about
some things in librabbitmq, but they are about the use of uninitialized
data, and may be harmless.)

The critical issue is a double free of the message buffer in
AMQPQueue::sendConsumeCommand: At AMQPQueue.cpp#L512, buf is handed to
the AMQPMessage object, and then freed. But AMQPMessage holds on to
this pointer, and frees it again in its destructor (called via the
message auto_ptr).

valgrind also revealed a lot of cases of amqpcpp trying to use freed
data (e.g. by passing a char* to AMQPQueue::setConsumerTag, you invoke
the implicit conversion to string, and the string data is freed after
the call; but setConsumerTag then uses c_str to get a pointer to the
string data, which is saved in consumer_tag and only used later in
sendConsumeCommand).

I think amqpcpp needs cleaning up with valgrind in order to work
reliably.

David

--
David Wragg
Staff Engineer, RabbitMQ
VMware, Inc.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 9 of 10 | next ›
Discussion Overview
grouprabbitmq-discuss @
categoriesrabbitmq
postedJul 20, '11 at 8:45p
activeJul 26, '11 at 3:32p
posts10
users2
websiterabbitmq.com
irc#rabbitmq

2 users in discussion

David Wragg: 5 posts Clint Miller: 5 posts

People

Translate

site design / logo © 2022 Grokbase