Giter Club home page Giter Club logo

librabbitmq's Issues

No transactions support?

Hi,

Maybe I've just overlooked something, but I can't find transactions support (tx_select, tx_commit, tx_rollback) in librabbitmq, however the underlying C library seems to support these.

Could you please implement it?

Thanks,

fileno not raising exception after connection.close is called

Unlike with for example py-amqp after calling connection.close() and then accessing the value of connection.fileno() it does not throw an AttributeError.

Is this intended?

e.g.

print connection.fileno()
connection.close()
print connection.fileno() # Shouldn't this throw an exception?

I don't have much experience with sockets on C library, but does this mean that the socket is still opened, or is the fileno value cached?

memory leak?

The piece of code(I means consumer) below eat 30M memory when consumer started, after 10 minutes, the memory usage is 970M.

can someone help me? thanks

# producer
from librabbitmq import Connection

conn = Connection('192.168.20.41')

channel = conn.channel()
channel.exchange_declare(exchange='x', type='direct', durable=True)
channel.queue_declare(queue='q', durable=True)
channel.queue_bind(queue='q', exchange='x', routing_key='rk')

while True:
    channel.basic_publish(('hello moto', {'delivery_mode' : 2}), 'x', 'rk')
# consumer
from librabbitmq import Connection

conn = Connection('192.168.20.41')

channel = conn.channel()
channel.exchange_declare(exchange='x', type='direct', durable=True)
channel.queue_declare(queue='q', durable=True)
channel.queue_bind(queue='q', exchange='x', routing_key='rk')

def dump_message(message):
    print("Body:'%s', Proeprties:'%s', DeliveryInfo:'%s'" % (
        message.body, message.properties, message.delivery_info))
    message.ack()

with channel:
    channel.basic_consume(callback=dump_message)
    while True:
        channel.connection.drain_events()

Old version of rabbitmq-c

Hello,
I've noticed the git submodule references a fork which has not been updated with latest code from rabbitmq-c, is this intentional? meaning is this library not compatible with the last code in rabbitmq-c?

Segfault SIGSEGV on running Celery worker and/or Flower

While running a celery worker from the command line:

python manage.py celery worker -E --loglevel=DEBUG --purge --logfile=celery1.log -n celery1 -Ofair --autoscale=10,12

(also happens when running flower:
python manage.py celery flower)

Actual segfault error, obtained using gdb:

Program received signal SIGSEGV, Segmentation fault.
0x00007fffebb926ab in amqp_pool_alloc () from /usr/lib/x86_64-linux-gnu/librabbitmq.so.1

basic stack:

Ubuntu 14 LTS (AWS EC2)
nginx
gunicorn
postgres (backend)
rabbitmq
celery

pip freeze:

Cheetah==2.4.4
Django==1.6.5
FormEncode==1.2.6
Landscape-Client==14.01
MySQL-python==1.2.3
PAM==0.4.2
Paste==1.7.5.1
PasteDeploy==1.5.2
PasteScript==1.7.5
PyYAML==3.10
South==1.0
Tempita==0.5.2
Twisted-Core==13.2.0
Twisted-Names==13.2.0
Twisted-Web==13.2.0
amqp==1.4.5
anyjson==0.3.3
apt-xapian-index==0.45
argparse==1.2.1
backports.ssl-match-hostname==3.4.0.2
billiard==3.3.0.18
celery==3.1.13
certifi==14.05.14
chardet==2.0.1
cl==0.0.3
cloud-init==0.7.5
colorama==0.2.5
configobj==4.7.2
django-appconf==0.6
django-celery==3.1.10
django-compressor==1.4
django-cors-headers==0.12
faulthandler==2.3
flower==0.7.2
gevent==1.0
greenlet==0.4.2
gunicorn==17.5
html5lib==0.999
jsonpatch==1.3
jsonpointer==1.0
kombu==3.0.21
mailer==0.7
numpy==1.8.1
oauth==1.0.1
prettytable==0.7.2
psycopg2==2.5.3
pyOpenSSL==0.13
pycurl==7.19.3
pydns==2.3.6
pyparsing==2.0.1
pyserial==2.6
python-apt==0.9.3.5
python-dateutil==1.5
python-debian==0.1.21-nmu2ubuntu2
python-memcached==1.53
python-openid==2.2.5
pytz==2012c
requests==2.2.1
scgi==1.13
setproctitle==1.0.1
six==1.5.2
ssh-import-id==3.21
tornado==4.0
urllib3==1.7.1
wsgiref==0.1.2
zope.interface==4.0.5

The solution I found was to install python-amqp, and remove python-librabbitmq

librabbitmq build fails on Debian 6.0.3

Installation of kombu fails with this message:

[...] out:   Running setup.py install for librabbitmq
[...] out:     /usr/bin/make  all-am
[...] out:     make[1]: Entering directory `/home/eksmo/virtualenv/eksmo/build/librabbitmq/rabbitmq-c/librabbitmq'
[...] out:     make[1]: Nothing to be done for `all-am'.
[...] out:     make[1]: Leaving directory `/home/eksmo/virtualenv/eksmo/build/librabbitmq/rabbitmq-c/librabbitmq'
[...] out:     - make rabbitmq-c...
[...] out:     building '_librabbitmq' extension
[...] out:     gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/home/eksmo/virtualenv/eksmo/build/librabbitmq/rabbitmq-c/librabbitmq -I/usr/include/python2.7 -c librabbitmq/_rabbitmqmodule.c -o build/temp.linux-x86_64-2.7/librabbitmq/_rabbitmqmodule.o
[...] out:     In file included from /usr/include/python2.7/Python.h:8:0,
[...] out:                      from librabbitmq/_rabbitmqmodule.h:16,
[...] out:                      from librabbitmq/_rabbitmqmodule.c:7:
[...] out:     /usr/include/python2.7/pyconfig.h:1161:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
[...] out:     /usr/include/features.h:214:0: note: this is the location of the previous definition
[...] out:     librabbitmq/_rabbitmqmodule.c: In function ‘PyRabbitMQ_Connection_basic_qos’:
[...] out:     librabbitmq/_rabbitmqmodule.c:1121:13: warning: assignment makes integer from pointer without a cast [enabled by default]
[...] out:     gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions /home/eksmo/virtualenv/eksmo/build/librabbitmq/rabbitmq-c/librabbitmq/amqp_api.o /home/eksmo/virtualenv/eksmo/build/librabbitmq/rabbitmq-c/librabbitmq/amqp_table.o /home/eksmo/virtualenv/eksmo/build/librabbitmq/rabbitmq-c/librabbitmq/amqp_mem.o /home/eksmo/virtualenv/eksmo/build/librabbitmq/rabbitmq-c/librabbitmq/amqp_connection.o /home/eksmo/virtualenv/eksmo/build/librabbitmq/rabbitmq-c/librabbitmq/socket.o /home/eksmo/virtualenv/eksmo/build/librabbitmq/rabbitmq-c/librabbitmq/amqp_socket.o /home/eksmo/virtualenv/eksmo/build/librabbitmq/rabbitmq-c/librabbitmq/amqp_framing.o /home/eksmo/virtualenv/eksmo/build/librabbitmq/rabbitmq-c/librabbitmq/amqp_url.o -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes build/temp.linux-x86_64-2.7/librabbitmq/_rabbitmqmodule.o -L/home/eksmo/virtualenv/eksmo/build/librabbitmq/rabbitmq-c/librabbitmq/.libs -o build/lib.linux-x86_64-2.7/_librabbitmq.so
[...] out:     /usr/bin/ld: /home/eksmo/virtualenv/eksmo/build/librabbitmq/rabbitmq-c/librabbitmq/amqp_api.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
[...] out:     /home/eksmo/virtualenv/eksmo/build/librabbitmq/rabbitmq-c/librabbitmq/amqp_api.o: could not read symbols: Bad value
[...] out:     collect2: ld returned 1 exit status
[...] out:     error: command 'gcc' failed with exit status 1
[...] out:     Complete output from command /home/eksmo/virtualenv/eksmo/bin/python -c "import setuptools;__file__='/home/eksmo/virtualenv/eksmo/build/librabbitmq/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-7ycder-record/install-record.txt --install-headers /home/eksmo/virtualenv/eksmo/include/site/python2.7:
[...] out:     running install

[...] out: running build

[...] out: /usr/bin/make  all-am

[...] out: make[1]: Entering directory `/home/eksmo/virtualenv/eksmo/build/librabbitmq/rabbitmq-c/librabbitmq'

[...] out: make[1]: Nothing to be done for `all-am'.

[...] out: make[1]: Leaving directory `/home/eksmo/virtualenv/eksmo/build/librabbitmq/rabbitmq-c/librabbitmq'

[...] out: - make rabbitmq-c...

[...] out: running build_py

[...] out: running build_ext

[...] out: building '_librabbitmq' extension

[...] out: gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/home/eksmo/virtualenv/eksmo/build/librabbitmq/rabbitmq-c/librabbitmq -I/usr/include/python2.7 -c librabbitmq/_rabbitmqmodule.c -o build/temp.linux-x86_64-2.7/librabbitmq/_rabbitmqmodule.o

[...] out: In file included from /usr/include/python2.7/Python.h:8:0,

[...] out:                  from librabbitmq/_rabbitmqmodule.h:16,

[...] out:                  from librabbitmq/_rabbitmqmodule.c:7:

[...] out: /usr/include/python2.7/pyconfig.h:1161:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]

[...] out: /usr/include/features.h:214:0: note: this is the location of the previous definition

[...] out: librabbitmq/_rabbitmqmodule.c: In function ‘PyRabbitMQ_Connection_basic_qos’:

[...] out: librabbitmq/_rabbitmqmodule.c:1121:13: warning: assignment makes integer from pointer without a cast [enabled by default]

[...] out: gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions /home/eksmo/virtualenv/eksmo/build/librabbitmq/rabbitmq-c/librabbitmq/amqp_api.o /home/eksmo/virtualenv/eksmo/build/librabbitmq/rabbitmq-c/librabbitmq/amqp_table.o /home/eksmo/virtualenv/eksmo/build/librabbitmq/rabbitmq-c/librabbitmq/amqp_mem.o /home/eksmo/virtualenv/eksmo/build/librabbitmq/rabbitmq-c/librabbitmq/amqp_connection.o /home/eksmo/virtualenv/eksmo/build/librabbitmq/rabbitmq-c/librabbitmq/socket.o /home/eksmo/virtualenv/eksmo/build/librabbitmq/rabbitmq-c/librabbitmq/amqp_socket.o /home/eksmo/virtualenv/eksmo/build/librabbitmq/rabbitmq-c/librabbitmq/amqp_framing.o /home/eksmo/virtualenv/eksmo/build/librabbitmq/rabbitmq-c/librabbitmq/amqp_url.o -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes build/temp.linux-x86_64-2.7/librabbitmq/_rabbitmqmodule.o -L/home/eksmo/virtualenv/eksmo/build/librabbitmq/rabbitmq-c/librabbitmq/.libs -o build/lib.linux-x86_64-2.7/_librabbitmq.so

[...] out: /usr/bin/ld: /home/eksmo/virtualenv/eksmo/build/librabbitmq/rabbitmq-c/librabbitmq/amqp_api.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC

[...] out: /home/eksmo/virtualenv/eksmo/build/librabbitmq/rabbitmq-c/librabbitmq/amqp_api.o: could not read symbols: Bad value

[...] out: collect2: ld returned 1 exit status

[...] out: error: command 'gcc' failed with exit status 1

[...] out: ----------------------------------------
[...] out: Command /home/eksmo/virtualenv/eksmo/bin/python -c "import setuptools;__file__='/home/eksmo/virtualenv/eksmo/build/librabbitmq/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-7ycder-record/install-record.txt --install-headers /home/eksmo/virtualenv/eksmo/include/site/python2.7 failed with error code 1 in /home/eksmo/virtualenv/eksmo/build/librabbitmq
[...] out: Storing complete log in /home/eksmo/.pip/pip.log

uses private amqp_get_or_create_channel_pool symbol from librabbitmq

Hello,

To me it looks like you use the amqp_get_or_create_channel_pool symbol, however that symbol is private to rabbitmq-c (it is defined in amqp_private.h), and it is not exported.

This basically means this package cannot be used with an already installed version of rabbitmq-c.

Thanks

some times, channel.queue_bind() takes 3 seconds

Here is the code:

    import time

    t0 = time.time()
    conn = Connection(host=conf.host, port=conf.port)

    t1 = time.time()
    channel = conn.channel()
    t2 = time.time()
    channel.exchange_declare(exchange=conf.exchange, type=conf.type, durable=conf.durable)
    t3 = time.time()
    channel.queue_declare(queue=conf.queue, durable=conf.durable)
    t4 = time.time()
    channel.queue_bind(queue=conf.queue, exchange=conf.exchange, routing_key=conf.routing_key)
    t5 = time.time()
    if t5 - t0 > 2:
        logger.info("Connection(): %s, conn.channel(): %s, channel.exchange_declare(): %s, channel.queue_declare(): %s, channel.queue_bind() %s", t5 - t4, t4 - t3, t3 - t2, t2 - t1, t1 - t0)

the log prints:
2013-01-08 18:18:00,229 INFO Connection(): 0.00176000595093, conn.channel(): 0.000516176223755, channel.exchange_declare(): 0.000393867492676, channel.queue_declare(): 0.000674962997437, channel.queue_bind() 3.14228796959

Enormous time taken in channel closing

https://gist.github.com/5ee3b7a980784089b4ff.git

I am publishing 200,000 of size 32 bytes.

I was originally getting a time of ~1.4 seconds for connection._basic_publish() to finish but channel.close() was taking a bit of time. So I set mandatory=False, yet the time difference is significant. Can someone please explain this time diff.

mandatory = True takes 1.41 sec to finish connection._basic_publish, while channel.close takes 11.9 seconds

when set to False, the numbers change to 1.3997 and 11.8177 seconds respectively.

Support for Python 3

It would be nice to support Python 3 at some point. Getting this error at the moment when running python3.3 setup.py build:

File "setup.py", line 185
    except Exception, exc:
                ^
SyntaxError: invalid syntax

Confusing branches

It's rather confusing that master is 1.0.1, there is another 1.0 branch, and the current version is branch 1.5. I think documentation is necessary on the master readme, at least. For context, I came here to find the changelog while considering an upgrade.

"ConnectionError: Couldn't log in: Unknown error 536871016"

Since we upgraded our celery to version 3 and started using librabbitmq, we started to see this particular error quite frequently:

"ConnectionError: Couldn't log in: Unknown error 536871016"

I looked through the librabbitmq c code, but it seems like this is the server error. Given that, not sure if this is the right place to ask about this issue, but I was wondering if anyone out there has experienced a similar issue. Non-descriptive message certainly doesn't help and I don't really see any errors in the rabbitmq server log.

I have provided information below. If you have a good idea of how to investigate this issue further, I would much appreciate it!

Thanks in advance.

Here are what the versions of software we are using:
Django==1.4
celery==3.0.5
librabbitmq==0.9.9
billiard==2.7.3.12
kombu==2.3.2

And below is the stacktrace of what we see.

File "/opt/nextdoor-ve/lib/python2.6/site-packages/celery/app/task.py", line 343, in delay
return self.apply_async(args, kwargs)

File "/opt/nextdoor-ve/lib/python2.6/site-packages/celery/app/task.py", line 458, in apply_async
with app.producer_or_acquire(producer) as P:

File "/usr/lib/python2.6/contextlib.py", line 16, in enter
return self.gen.next()

File "/opt/nextdoor-ve/lib/python2.6/site-packages/celery/app/base.py", line 247, in producer_or_acquire
with self.amqp.producer_pool.acquire(block=True) as producer:

File "/opt/nextdoor-ve/lib/python2.6/site-packages/kombu/connection.py", line 705, in acquire
R = self.prepare(R)

File "/opt/nextdoor-ve/lib/python2.6/site-packages/kombu/pools.py", line 54, in prepare
p = p()

File "/opt/nextdoor-ve/lib/python2.6/site-packages/kombu/pools.py", line 45, in
return lambda: self.create_producer()

File "/opt/nextdoor-ve/lib/python2.6/site-packages/kombu/pools.py", line 42, in create_producer
return self.Producer(self._acquire_connection())

File "/opt/nextdoor-ve/lib/python2.6/site-packages/celery/app/amqp.py", line 160, in init
super(TaskProducer, self).init(channel, exchange, _args, *_kwargs)

File "/opt/nextdoor-ve/lib/python2.6/site-packages/kombu/messaging.py", line 83, in init
self.revive(self.channel)

File "/opt/nextdoor-ve/lib/python2.6/site-packages/kombu/messaging.py", line 174, in revive
channel = self.channel = maybe_channel(channel)

File "/opt/nextdoor-ve/lib/python2.6/site-packages/kombu/connection.py", line 879, in maybe_channel
return channel.default_channel

File "/opt/nextdoor-ve/lib/python2.6/site-packages/kombu/connection.py", line 617, in default_channel
self.connection

File "/opt/nextdoor-ve/lib/python2.6/site-packages/kombu/connection.py", line 610, in connection
self._connection = self._establish_connection()

File "/opt/nextdoor-ve/lib/python2.6/site-packages/kombu/connection.py", line 569, in _establish_connection
conn = self.transport.establish_connection()

File "/opt/nextdoor-ve/lib/python2.6/site-packages/kombu/transport/librabbitmq.py", line 108, in establish_connection
connect_timeout=conninfo.connect_timeout)

File "/opt/nextdoor-ve/lib/python2.6/site-packages/librabbitmq/init.py", line 168, in init
self.connect()

ConnectionError: Couldn't log in: Unknown error 536871016

easy_install librabbitmq fails on Ubuntu 12.04

Using pip to install librabbitmq succeeds, but using easy_install or "python setup.py install", fails. My OS is Ubuntu 12.04. I had similar results on Scientific Linux 6.

pip succeeds

$ virtualenv venv
New python executable in venv/bin/python
Installing setuptools............done.
Installing pip...............done.

$ source venv/bin/activate

$ pip install librabbitmq==1.0.1
Downloading/unpacking librabbitmq==1.0.1
  Downloading librabbitmq-1.0.1.tar.gz (445kB): 445kB downloaded
  Running setup.py egg_info for package librabbitmq

    warning: no files found matching '*' under directory 'tests'
    no previously-included directories found matching '*.pyc'
    no previously-included directories found matching '*.o'
    no previously-included directories found matching '*.la'
    no previously-included directories found matching '*.so'
    no previously-included directories found matching '*.dylib'
Installing collected packages: librabbitmq
  Running setup.py install for librabbitmq
    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether build environment is sane... yes
    checking for a thread-safe mkdir -p... /bin/mkdir -p
    checking for gawk... no
    checking for mawk... mawk
    checking whether make sets $(MAKE)... yes
    checking whether make supports nested variables... yes
    checking for style of include used by make... GNU
    checking for gcc... gcc
    checking whether the C compiler works... yes
    checking for C compiler default output file name... a.out
    checking for suffix of executables...
    checking whether we are cross compiling... no
    checking for suffix of object files... o
    checking whether we are using the GNU C compiler... yes
    checking whether gcc accepts -g... yes
    checking for gcc option to accept ISO C89... none needed
    checking dependency style of gcc... none
    checking how to run the C preprocessor... gcc -E
    checking for grep that handles long lines and -e... /bin/grep
    checking for egrep... /bin/grep -E
    checking for ANSI C header files... yes
    checking for sys/types.h... yes
    checking for sys/stat.h... yes
    checking for stdlib.h... yes
    checking for string.h... yes
    checking for memory.h... yes
    checking for strings.h... yes
    checking for inttypes.h... yes
    checking for stdint.h... yes
    checking for unistd.h... yes
    checking minix/config.h usability... no
    checking minix/config.h presence... no
    checking for minix/config.h... no
    checking whether it is safe to define __EXTENSIONS__... yes
    checking build system type... x86_64-unknown-linux-gnu
    checking host system type... x86_64-unknown-linux-gnu
    checking how to print strings... printf
    checking for a sed that does not truncate output... /bin/sed
    checking for fgrep... /bin/grep -F
    checking for ld used by gcc... /usr/bin/ld
    checking if the linker (/usr/bin/ld) is GNU ld... yes
    checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
    checking the name lister (/usr/bin/nm -B) interface... BSD nm
    checking whether ln -s works... yes
    checking the maximum length of command line arguments... 1572864
    checking whether the shell understands some XSI constructs... yes
    checking whether the shell understands "+="... yes
    checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
    checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
    checking for /usr/bin/ld option to reload object files... -r
    checking for objdump... objdump
    checking how to recognize dependent libraries... pass_all
    checking for dlltool... no
    checking how to associate runtime and link libraries... printf %s\n
    checking for ar... ar
    checking for archiver @FILE support... @
    checking for strip... strip
    checking for ranlib... ranlib
    checking command to parse /usr/bin/nm -B output from gcc object... ok
    checking for sysroot... no
    checking for mt... mt
    checking if mt is a manifest tool... no
    checking for dlfcn.h... yes
    checking for objdir... .libs
    checking if gcc supports -fno-rtti -fno-exceptions... no
    checking for gcc option to produce PIC... -fPIC -DPIC
    checking if gcc PIC flag -fPIC -DPIC works... yes
    checking if gcc static flag -static works... yes
    checking if gcc supports -c -o file.o... yes
    checking if gcc supports -c -o file.o... (cached) yes
    checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
    checking whether -lc should be explicitly linked in... no
    checking dynamic linker characteristics... GNU/Linux ld.so
    checking how to hardcode library paths into programs... immediate
    checking whether stripping libraries is possible... yes
    checking if libtool supports shared libraries... yes
    checking whether to build shared libraries... yes
    checking whether to build static libraries... no
    checking for gcc option to accept ISO C99... -std=gnu99
    checking whether byte ordering is bigendian... no
    checking for inline... inline
    checking if compiler accepts '-Wall'... yes
    checking if compiler accepts '-Wextra'... yes
    checking if compiler accepts '-pedantic'... yes
    checking if compiler accepts '-Wstrict-prototypes'... yes
    checking if compiler accepts '-Wcast-align'... yes
    checking if compiler accepts '-fno-common'... yes
    checking if compiler accepts '-fvisibility=hidden'... yes
    checking if linker accepts '-no-undefined'... no
    checking for Python with 'json'... /home/eliot/tmp/venv/bin/python
    checking for Python with 'simplejson'... (cached) /home/eliot/tmp/venv/bin/python
    checking that generated files are newer than configure... done
    configure: creating ./config.status
    config.status: creating librabbitmq.pc
    config.status: creating Makefile
    config.status: creating config.h
    config.status: executing depfiles commands
    config.status: executing libtool commands

    rabbitmq-c build options:
        Host: x86_64-unknown-linux-gnu
        Version: 0.2.0
        64-bit: no
        Tools: no
        Documentation: no

    - configure rabbitmq-c...
    - generating 'clib/librabbitmq/amqp_framing.h'
    /home/eliot/tmp/venv/bin/python clib/librabbitmq/codegen.py header rabbitmq-codegen/amqp-rabbitmq-0.9.1.json clib/librabbitmq/amqp_framing.h
    - generating 'clib/librabbitmq/amqp_framing.c'
    /home/eliot/tmp/venv/bin/python clib/librabbitmq/codegen.py body rabbitmq-codegen/amqp-rabbitmq-0.9.1.json clib/librabbitmq/amqp_framing.c
    building '_librabbitmq' extension
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -W -Wall -DHAVE_CONFIG_H -fPIC -Iclib/librabbitmq -Iclib -Iclib/librabbitmq/unix -I/usr/include/python2.7 -c Modules/_librabbitmq/connection.c -o build/temp.linux-x86_64-2.7/Modules/_librabbitmq/connection.o
    In file included from /usr/include/python2.7/Python.h:8:0,
                     from Modules/_librabbitmq/connection.h:4,
                     from Modules/_librabbitmq/connection.c:10:
    /usr/include/python2.7/pyconfig.h:1161:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
    /usr/include/features.h:215:0: note: this is the location of the previous definition
    Modules/_librabbitmq/connection.c: In function ‘PyRabbitMQ_Connection_close’:
    Modules/_librabbitmq/connection.c:978:22: warning: variable ‘reply’ set but not used [-Wunused-but-set-variable]
    Modules/_librabbitmq/connection.c: In function ‘PyRabbitMQ_Connection_basic_cancel’:
    Modules/_librabbitmq/connection.c:1731:29: warning: variable ‘ok’ set but not used [-Wunused-but-set-variable]
    Modules/_librabbitmq/connection.c: In function ‘PyRabbitMQ_Connection_flow’:
    Modules/_librabbitmq/connection.c:1850:29: warning: variable ‘ok’ set but not used [-Wunused-but-set-variable]
    Modules/_librabbitmq/connection.c: In function ‘PyRabbitMQ_Connection_basic_recover’:
    Modules/_librabbitmq/connection.c:1883:30: warning: variable ‘ok’ set but not used [-Wunused-but-set-variable]
    Modules/_librabbitmq/connection.c: At top level:
    Modules/_librabbitmq/connection.c:685:26: warning: ‘PyDict_ToAMQTable’ is static but used in inline function ‘PyDict_to_basic_properties’ which is not static [enabled by default]
    Modules/_librabbitmq/connection.c:465:17: warning: ‘AMQTable_toPyDict’ is static but used in inline function ‘basic_properties_to_PyDict’ which is not static [enabled by default]
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -W -Wall -DHAVE_CONFIG_H -fPIC -Iclib/librabbitmq -Iclib -Iclib/librabbitmq/unix -I/usr/include/python2.7 -c clib/librabbitmq/amqp_api.c -o build/temp.linux-x86_64-2.7/clib/librabbitmq/amqp_api.o
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -W -Wall -DHAVE_CONFIG_H -fPIC -Iclib/librabbitmq -Iclib -Iclib/librabbitmq/unix -I/usr/include/python2.7 -c clib/librabbitmq/amqp_mem.c -o build/temp.linux-x86_64-2.7/clib/librabbitmq/amqp_mem.o
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -W -Wall -DHAVE_CONFIG_H -fPIC -Iclib/librabbitmq -Iclib -Iclib/librabbitmq/unix -I/usr/include/python2.7 -c clib/librabbitmq/amqp_url.c -o build/temp.linux-x86_64-2.7/clib/librabbitmq/amqp_url.o
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -W -Wall -DHAVE_CONFIG_H -fPIC -Iclib/librabbitmq -Iclib -Iclib/librabbitmq/unix -I/usr/include/python2.7 -c clib/librabbitmq/amqp_connection.c -o build/temp.linux-x86_64-2.7/clib/librabbitmq/amqp_connection.o
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -W -Wall -DHAVE_CONFIG_H -fPIC -Iclib/librabbitmq -Iclib -Iclib/librabbitmq/unix -I/usr/include/python2.7 -c clib/librabbitmq/amqp_socket.c -o build/temp.linux-x86_64-2.7/clib/librabbitmq/amqp_socket.o
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -W -Wall -DHAVE_CONFIG_H -fPIC -Iclib/librabbitmq -Iclib -Iclib/librabbitmq/unix -I/usr/include/python2.7 -c clib/librabbitmq/amqp_framing.c -o build/temp.linux-x86_64-2.7/clib/librabbitmq/amqp_framing.o
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -W -Wall -DHAVE_CONFIG_H -fPIC -Iclib/librabbitmq -Iclib -Iclib/librabbitmq/unix -I/usr/include/python2.7 -c clib/librabbitmq/amqp_table.c -o build/temp.linux-x86_64-2.7/clib/librabbitmq/amqp_table.o
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -W -Wall -DHAVE_CONFIG_H -fPIC -Iclib/librabbitmq -Iclib -Iclib/librabbitmq/unix -I/usr/include/python2.7 -c clib/librabbitmq/unix/socket.c -o build/temp.linux-x86_64-2.7/clib/librabbitmq/unix/socket.o
    gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -W -Wall -DHAVE_CONFIG_H build/temp.linux-x86_64-2.7/Modules/_librabbitmq/connection.o build/temp.linux-x86_64-2.7/clib/librabbitmq/amqp_api.o build/temp.linux-x86_64-2.7/clib/librabbitmq/amqp_mem.o build/temp.linux-x86_64-2.7/clib/librabbitmq/amqp_url.o build/temp.linux-x86_64-2.7/clib/librabbitmq/amqp_connection.o build/temp.linux-x86_64-2.7/clib/librabbitmq/amqp_socket.o build/temp.linux-x86_64-2.7/clib/librabbitmq/amqp_framing.o build/temp.linux-x86_64-2.7/clib/librabbitmq/amqp_table.o build/temp.linux-x86_64-2.7/clib/librabbitmq/unix/socket.o -o build/lib.linux-x86_64-2.7/_librabbitmq.so

    warning: no files found matching '*' under directory 'tests'
    no previously-included directories found matching '*.pyc'
    no previously-included directories found matching '*.o'
    no previously-included directories found matching '*.la'
    no previously-included directories found matching '*.so'
    no previously-included directories found matching '*.dylib'
Successfully installed librabbitmq
Cleaning up...

python setup.py install fails

$ virtualenv venv
$ source venv/bin/activate
$ wget http://pypi.python.org/packages/source/l/librabbitmq/librabbitmq-1.0.1.tar.gz#md5=7350f2018d789116e861a9e1a83e2e86
$ tar xvf librabbitmq-1.0.1.tar.gz 
$ cd librabbitmq-1.0.1/
$ python setup.py install
running install
running bdist_egg
running egg_info
writing librabbitmq.egg-info/PKG-INFO
writing top-level names to librabbitmq.egg-info/top_level.txt
writing dependency_links to librabbitmq.egg-info/dependency_links.txt
reading manifest file 'librabbitmq.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*' under directory 'tests'
no previously-included directories found matching '*.pyc'
no previously-included directories found matching '*.o'
no previously-included directories found matching '*.la'
no previously-included directories found matching '*.so'
no previously-included directories found matching '*.dylib'
writing manifest file 'librabbitmq.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/funtests
copying funtests/setup.py -> build/lib.linux-x86_64-2.7/funtests
copying funtests/disabled_basic_get_leak.py -> build/lib.linux-x86_64-2.7/funtests
copying funtests/__init__.py -> build/lib.linux-x86_64-2.7/funtests
copying funtests/config.py -> build/lib.linux-x86_64-2.7/funtests
creating build/lib.linux-x86_64-2.7/librabbitmq
copying librabbitmq/__init__.py -> build/lib.linux-x86_64-2.7/librabbitmq
creating build/lib.linux-x86_64-2.7/funtests/tests
copying funtests/tests/test_channel_errors.py -> build/lib.linux-x86_64-2.7/funtests/tests
copying funtests/tests/__init__.py -> build/lib.linux-x86_64-2.7/funtests/tests
running build_ext
building '_librabbitmq' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/Modules
creating build/temp.linux-x86_64-2.7/Modules/_librabbitmq
creating build/temp.linux-x86_64-2.7/clib
creating build/temp.linux-x86_64-2.7/clib/librabbitmq
creating build/temp.linux-x86_64-2.7/clib/librabbitmq/unix
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Iclib/librabbitmq -Iclib -Iclib/librabbitmq/unix -I/usr/include/python2.7 -c Modules/_librabbitmq/connection.c -o build/temp.linux-x86_64-2.7/Modules/_librabbitmq/connection.o
In file included from /usr/include/python2.7/Python.h:8:0,
                 from Modules/_librabbitmq/connection.h:4,
                 from Modules/_librabbitmq/connection.c:10:
/usr/include/python2.7/pyconfig.h:1161:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
/usr/include/features.h:215:0: note: this is the location of the previous definition
Modules/_librabbitmq/connection.c: In function ‘PyRabbitMQ_Connection_close’:
Modules/_librabbitmq/connection.c:978:22: warning: variable ‘reply’ set but not used [-Wunused-but-set-variable]
Modules/_librabbitmq/connection.c: In function ‘PyRabbitMQ_Connection_basic_cancel’:
Modules/_librabbitmq/connection.c:1731:29: warning: variable ‘ok’ set but not used [-Wunused-but-set-variable]
Modules/_librabbitmq/connection.c: In function ‘PyRabbitMQ_Connection_flow’:
Modules/_librabbitmq/connection.c:1850:29: warning: variable ‘ok’ set but not used [-Wunused-but-set-variable]
Modules/_librabbitmq/connection.c: In function ‘PyRabbitMQ_Connection_basic_recover’:
Modules/_librabbitmq/connection.c:1883:30: warning: variable ‘ok’ set but not used [-Wunused-but-set-variable]
Modules/_librabbitmq/connection.c: At top level:
Modules/_librabbitmq/connection.c:685:26: warning: ‘PyDict_ToAMQTable’ is static but used in inline function ‘PyDict_to_basic_properties’ which is not static [enabled by default]
Modules/_librabbitmq/connection.c:465:17: warning: ‘AMQTable_toPyDict’ is static but used in inline function ‘basic_properties_to_PyDict’ which is not static [enabled by default]
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Iclib/librabbitmq -Iclib -Iclib/librabbitmq/unix -I/usr/include/python2.7 -c clib/librabbitmq/amqp_api.c -o build/temp.linux-x86_64-2.7/clib/librabbitmq/amqp_api.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Iclib/librabbitmq -Iclib -Iclib/librabbitmq/unix -I/usr/include/python2.7 -c clib/librabbitmq/amqp_mem.c -o build/temp.linux-x86_64-2.7/clib/librabbitmq/amqp_mem.o
clib/librabbitmq/amqp_mem.c: In function ‘amqp_version’:
clib/librabbitmq/amqp_mem.c:46:10: error: ‘VERSION’ undeclared (first use in this function)
clib/librabbitmq/amqp_mem.c:46:10: note: each undeclared identifier is reported only once for each function it appears in
clib/librabbitmq/amqp_mem.c:47:1: warning: control reaches end of non-void function [-Wreturn-type]
error: command 'gcc' failed with exit status 1

easy_install fails

$ virtualenv venv
New python executable in venv/bin/python
Installing setuptools............done.
Installing pip...............done.

$ source venv/bin/activate

$ easy_install librabbitmq==1.0.1
Searching for librabbitmq==1.0.1
Reading http://pypi.python.org/simple/librabbitmq/
Reading http://github.com/celery/librabbitmq
Best match: librabbitmq 1.0.1
Downloading http://pypi.python.org/packages/source/l/librabbitmq/librabbitmq-1.0.1.tar.gz#md5=7350f2018d789116e861a9e1a83e2e86
Processing librabbitmq-1.0.1.tar.gz
Running librabbitmq-1.0.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-2TimqH/librabbitmq-1.0.1/egg-dist-tmp-aYwKYi
warning: no files found matching '*' under directory 'tests'
no previously-included directories found matching '*.pyc'
no previously-included directories found matching '*.o'
no previously-included directories found matching '*.la'
no previously-included directories found matching '*.so'
no previously-included directories found matching '*.dylib'
In file included from /usr/include/python2.7/Python.h:8:0,
                 from Modules/_librabbitmq/connection.h:4,
                 from Modules/_librabbitmq/connection.c:10:
/usr/include/python2.7/pyconfig.h:1161:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
/usr/include/features.h:215:0: note: this is the location of the previous definition
Modules/_librabbitmq/connection.c: In function ‘PyRabbitMQ_Connection_close’:
Modules/_librabbitmq/connection.c:978:22: warning: variable ‘reply’ set but not used [-Wunused-but-set-variable]
Modules/_librabbitmq/connection.c: In function ‘PyRabbitMQ_Connection_basic_cancel’:
Modules/_librabbitmq/connection.c:1731:29: warning: variable ‘ok’ set but not used [-Wunused-but-set-variable]
Modules/_librabbitmq/connection.c: In function ‘PyRabbitMQ_Connection_flow’:
Modules/_librabbitmq/connection.c:1850:29: warning: variable ‘ok’ set but not used [-Wunused-but-set-variable]
Modules/_librabbitmq/connection.c: In function ‘PyRabbitMQ_Connection_basic_recover’:
Modules/_librabbitmq/connection.c:1883:30: warning: variable ‘ok’ set but not used [-Wunused-but-set-variable]
Modules/_librabbitmq/connection.c: At top level:
Modules/_librabbitmq/connection.c:685:26: warning: ‘PyDict_ToAMQTable’ is static but used in inline function ‘PyDict_to_basic_properties’ which is not static [enabled by default]
Modules/_librabbitmq/connection.c:465:17: warning: ‘AMQTable_toPyDict’ is static but used in inline function ‘basic_properties_to_PyDict’ which is not static [enabled by default]
clib/librabbitmq/amqp_mem.c: In function ‘amqp_version’:
clib/librabbitmq/amqp_mem.c:46:10: error: ‘VERSION’ undeclared (first use in this function)
clib/librabbitmq/amqp_mem.c:46:10: note: each undeclared identifier is reported only once for each function it appears in
clib/librabbitmq/amqp_mem.c:47:1: warning: control reaches end of non-void function [-Wreturn-type]
error: Setup script exited with error: command 'gcc' failed with exit status 1

Buildout fails for 1.6.1

I'm trying to install librabbitmq==1.6.1 using egg recipe of bootstrap buildout.
It's installing it using this command:

    librabbitmq-1.6.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-G0KrCc/librabbitmq-1.6.1/egg-dist-tmp-IbHAd3

And fails this way:

    warning: no files found matching '*' under directory 'tests'
    no previously-included directories found matching '*.pyc'
    no previously-included directories found matching '*.o'
    no previously-included directories found matching '*.la'
    no previously-included directories found matching '*.so'
    no previously-included directories found matching '*.dylib'
    In file included from /usr/include/python2.7/pyconfig.h:6:0,
                     from /usr/include/python2.7/Python.h:8,
                     from Modules/_librabbitmq/connection.h:4,
                     from Modules/_librabbitmq/connection.c:11:
    /usr/include/python2.7/pyconfig-64.h:1170:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
    /usr/include/features.h:168:0: note: this is the location of the previous definition
    /usr/include/python2.7/pyconfig-64.h:1192:0: warning: "_XOPEN_SOURCE" redefined [enabled by default]
    /usr/include/features.h:170:0: note: this is the location of the previous definition
    Modules/_librabbitmq/connection.c: In function ‘PyIter_ToAMQArray’:
    Modules/_librabbitmq/connection.c:335:5: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
    Modules/_librabbitmq/connection.c:380:1: warning: label ‘error’ defined but not used [-Wunused-label]
    Modules/_librabbitmq/connection.c: In function ‘PyRabbitMQ_Connection_close’:
    Modules/_librabbitmq/connection.c:1043:22: warning: variable ‘reply’ set but not used [-Wunused-but-set-variable]
    Modules/_librabbitmq/connection.c: In function ‘PyRabbitMQ_Connection_basic_cancel’:
    Modules/_librabbitmq/connection.c:1863:29: warning: variable ‘ok’ set but not used [-Wunused-but-set-variable]
    Modules/_librabbitmq/connection.c: In function ‘PyRabbitMQ_Connection_flow’:
    Modules/_librabbitmq/connection.c:1988:29: warning: variable ‘ok’ set but not used [-Wunused-but-set-variable]
    Modules/_librabbitmq/connection.c: In function ‘PyRabbitMQ_Connection_basic_recover’:
    Modules/_librabbitmq/connection.c:2021:30: warning: variable ‘ok’ set but not used [-Wunused-but-set-variable]
    Modules/_librabbitmq/connection.c: At top level:
    Modules/_librabbitmq/connection.c:719:26: warning: ‘PyDict_ToAMQTable’ is static but used in inline function ‘PyDict_to_basic_properties’ which is not static [enabled by default]
    Modules/_librabbitmq/connection.c:496:17: warning: ‘AMQTable_toPyDict’ is static but used in inline function ‘basic_properties_to_PyDict’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:345:1: warning: ‘__bswap_32’ is static but used in inline function ‘amqp_d32’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:345:1: warning: ‘__bswap_32’ is static but used in inline function ‘amqp_e32’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:340:1: warning: ‘__bswap_32’ is static but used in inline function ‘ntohll’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:340:1: warning: ‘__bswap_32’ is static but used in inline function ‘ntohll’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:339:1: warning: ‘__bswap_32’ is static but used in inline function ‘htonll’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:339:1: warning: ‘__bswap_32’ is static but used in inline function ‘htonll’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:345:1: warning: ‘__bswap_32’ is static but used in inline function ‘amqp_d32’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:345:1: warning: ‘__bswap_32’ is static but used in inline function ‘amqp_e32’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:340:1: warning: ‘__bswap_32’ is static but used in inline function ‘ntohll’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:340:1: warning: ‘__bswap_32’ is static but used in inline function ‘ntohll’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:339:1: warning: ‘__bswap_32’ is static but used in inline function ‘htonll’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:339:1: warning: ‘__bswap_32’ is static but used in inline function ‘htonll’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:345:1: warning: ‘__bswap_32’ is static but used in inline function ‘amqp_d32’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:345:1: warning: ‘__bswap_32’ is static but used in inline function ‘amqp_e32’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:340:1: warning: ‘__bswap_32’ is static but used in inline function ‘ntohll’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:340:1: warning: ‘__bswap_32’ is static but used in inline function ‘ntohll’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:339:1: warning: ‘__bswap_32’ is static but used in inline function ‘htonll’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:339:1: warning: ‘__bswap_32’ is static but used in inline function ‘htonll’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:345:1: warning: ‘__bswap_32’ is static but used in inline function ‘amqp_d32’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:345:1: warning: ‘__bswap_32’ is static but used in inline function ‘amqp_e32’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:340:1: warning: ‘__bswap_32’ is static but used in inline function ‘ntohll’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:340:1: warning: ‘__bswap_32’ is static but used in inline function ‘ntohll’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:339:1: warning: ‘__bswap_32’ is static but used in inline function ‘htonll’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:339:1: warning: ‘__bswap_32’ is static but used in inline function ‘htonll’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:345:1: warning: ‘__bswap_32’ is static but used in inline function ‘amqp_d32’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:345:1: warning: ‘__bswap_32’ is static but used in inline function ‘amqp_e32’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:340:1: warning: ‘__bswap_32’ is static but used in inline function ‘ntohll’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:340:1: warning: ‘__bswap_32’ is static but used in inline function ‘ntohll’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:339:1: warning: ‘__bswap_32’ is static but used in inline function ‘htonll’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:339:1: warning: ‘__bswap_32’ is static but used in inline function ‘htonll’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:345:1: warning: ‘__bswap_32’ is static but used in inline function ‘amqp_d32’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:345:1: warning: ‘__bswap_32’ is static but used in inline function ‘amqp_e32’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:340:1: warning: ‘__bswap_32’ is static but used in inline function ‘ntohll’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:340:1: warning: ‘__bswap_32’ is static but used in inline function ‘ntohll’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:339:1: warning: ‘__bswap_32’ is static but used in inline function ‘htonll’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:339:1: warning: ‘__bswap_32’ is static but used in inline function ‘htonll’ which is not static [enabled by default]
    clib/librabbitmq/amqp_socket.c: In function ‘amqp_login_inner’:
    clib/librabbitmq/amqp_socket.c:1195:28: error: ‘AMQ_PLATFORM’ undeclared (first use in this function)
    clib/librabbitmq/amqp_socket.c:1195:28: note: each undeclared identifier is reported only once for each function it appears in
    clib/librabbitmq/amqp_socket.c: At top level:
    clib/librabbitmq/amqp_private.h:345:1: warning: ‘__bswap_32’ is static but used in inline function ‘amqp_d32’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:345:1: warning: ‘__bswap_32’ is static but used in inline function ‘amqp_e32’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:340:1: warning: ‘__bswap_32’ is static but used in inline function ‘ntohll’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:340:1: warning: ‘__bswap_32’ is static but used in inline function ‘ntohll’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:339:1: warning: ‘__bswap_32’ is static but used in inline function ‘htonll’ which is not static [enabled by default]
    clib/librabbitmq/amqp_private.h:339:1: warning: ‘__bswap_32’ is static but used in inline function ‘htonll’ which is not static [enabled by default]
    error: command 'gcc' failed with exit status 1

It seems like configure hasn't been run.
The same ocurrs if I run

    python27 setup.py -q bdist_egg

But if I run

    python27 setup.py

It installs properly.

Unexpected keyword 'no_ack' when running with Kombu basic_get

When running in kombu.compat mode with librabbitmq as the transport, fetch fails with unexpected keyword 'no_ack'. The patch at git://gist.github.com/1233068.git fixes pylibrabbitmq to expect 'no_ack' instead of 'noack' and makes the calling sequence consistent with the rest of the code.

`PyDict_ToAMQTable` does not support nested tables

PyDict_ToAMQTable (Modules/_librabbitmq/connection.c) only processes Int, Long, String, Unicode, but AFAICT (confirmed) AMQP also supports nested tables ... which is useful :-)

for the record, pyamqp transport in Kombu seems to be capable of marshaling the nested structures ... my C is still pretty green but it seems like you could just call PyDict_ToAMQTable recursively?

_librabbitmq.ConnectionError: Couldn't create channel: server connection error 505, message: UNEXPECTED_FRAME - expected content body, got non content body frame instead

I compiled 1.6.1 on Solaris using a gcc 4.8.3 toolchain. I'm running RabbitMQ 3.5.4 on Erlang 18.0. I get the error above even trying to execute the simple disabled_basic_get_leak.py test. I first discovered the problem when trying to run Celery 3.1.18 for the first time since compiling it and had a hanging beat process. It works fine with py-ampq. Below is the traceback on the test and the compilation below.

bash-3.2$ python disabled_basic_get_leak.py
Traceback (most recent call last):
  File "disabled_basic_get_leak.py", line 14, in <module>
    c.basic_publish('foo', exchange='getmem', routing_key='getmem')
  File "/opt/app/myapp/software-ng/python/lib/python2.7/site-packages/librabbitmq-1.6.1-py2.7-solaris-2.10-sun4v.64bit.egg/librabbitmq/__init__.py", line 117, in basic_publish
    mandatory or False, immediate or False,
_librabbitmq.ConnectionError: Couldn't create channel: server connection error 505, message: UNEXPECTED_FRAME - expected content body, got non content body frame instead
running build
- generating 'clib/librabbitmq/amqp_framing.h'
/opt/app/myapp/software-ng/python/bin/python clib/librabbitmq/codegen.py header rabbitmq-codegen/amqp-rabbitmq-0.9.1.json clib/librabbitmq/amqp_framing.h
- generating 'clib/librabbitmq/amqp_framing.c'
/opt/app/myapp/software-ng/python/bin/python clib/librabbitmq/codegen.py body rabbitmq-codegen/amqp-rabbitmq-0.9.1.json clib/librabbitmq/amqp_framing.c
running build_py
running build_ext
building '_librabbitmq' extension
gcc -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wstrict-prototypes -DHAVE_CONFIG_H -I/opt/app/myapp/software-ng/common/include -fPIC -Iclib/librabbitmq -Iclib -I/opt/app/myapp/software-ng/python/include/python2.7 -c Modules/_librabbitmq/connection.c -o build/temp.solaris-2.10-sun4v.64bit-2.7/Modules/_librabbitmq/connection.o
Modules/_librabbitmq/connection.c: In function ‘PyIter_ToAMQArray’:
Modules/_librabbitmq/connection.c:335:5: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
     while (item = PyIter_Next(iterator)) {
     ^
Modules/_librabbitmq/connection.c:380:1: warning: label ‘error’ defined but not used [-Wunused-label]
 error:
 ^
Modules/_librabbitmq/connection.c: In function ‘PyRabbitMQ_Connection_close’:
Modules/_librabbitmq/connection.c:1043:22: warning: variable ‘reply’ set but not used [-Wunused-but-set-variable]
     amqp_rpc_reply_t reply;
                      ^
Modules/_librabbitmq/connection.c: In function ‘PyRabbitMQ_Connection_basic_cancel’:
Modules/_librabbitmq/connection.c:1863:29: warning: variable ‘ok’ set but not used [-Wunused-but-set-variable]
     amqp_basic_cancel_ok_t *ok;
                             ^
Modules/_librabbitmq/connection.c: In function ‘PyRabbitMQ_Connection_flow’:
Modules/_librabbitmq/connection.c:1988:29: warning: variable ‘ok’ set but not used [-Wunused-but-set-variable]
     amqp_channel_flow_ok_t *ok;
                             ^
Modules/_librabbitmq/connection.c: In function ‘PyRabbitMQ_Connection_basic_recover’:
Modules/_librabbitmq/connection.c:2021:30: warning: variable ‘ok’ set but not used [-Wunused-but-set-variable]
     amqp_basic_recover_ok_t *ok;
                              ^
Modules/_librabbitmq/connection.c: At top level:
Modules/_librabbitmq/connection.c:719:26: warning: ‘PyDict_ToAMQTable’ is static but used in inline function ‘PyDict_to_basic_properties’ which is not static [enabled by default]
         props->headers = PyDict_ToAMQTable(conn, value, pool);
                          ^
Modules/_librabbitmq/connection.c:496:17: warning: ‘AMQTable_toPyDict’ is static but used in inline function ‘basic_properties_to_PyDict’ which is not static [enabled by default]
         value = AMQTable_toPyDict(&(props->headers));
                 ^
gcc -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wstrict-prototypes -DHAVE_CONFIG_H -I/opt/app/myapp/software-ng/common/include -fPIC -Iclib/librabbitmq -Iclib -I/opt/app/myapp/software-ng/python/include/python2.7 -c clib/librabbitmq/amqp_api.c -o build/temp.solaris-2.10-sun4v.64bit-2.7/clib/librabbitmq/amqp_api.o
gcc -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wstrict-prototypes -DHAVE_CONFIG_H -I/opt/app/myapp/software-ng/common/include -fPIC -Iclib/librabbitmq -Iclib -I/opt/app/myapp/software-ng/python/include/python2.7 -c clib/librabbitmq/amqp_connection.c -o build/temp.solaris-2.10-sun4v.64bit-2.7/clib/librabbitmq/amqp_connection.o
clib/librabbitmq/amqp_connection.c: In function ‘amqp_send_frame’:
clib/librabbitmq/amqp_connection.c:466:21: warning: pointer targets in assignment differ in signedness [-Wpointer-sign]
     iov[2].iov_base = &frame_end_byte;
                     ^
gcc -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wstrict-prototypes -DHAVE_CONFIG_H -I/opt/app/myapp/software-ng/common/include -fPIC -Iclib/librabbitmq -Iclib -I/opt/app/myapp/software-ng/python/include/python2.7 -c clib/librabbitmq/amqp_consumer.c -o build/temp.solaris-2.10-sun4v.64bit-2.7/clib/librabbitmq/amqp_consumer.o
gcc -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wstrict-prototypes -DHAVE_CONFIG_H -I/opt/app/myapp/software-ng/common/include -fPIC -Iclib/librabbitmq -Iclib -I/opt/app/myapp/software-ng/python/include/python2.7 -c clib/librabbitmq/amqp_framing.c -o build/temp.solaris-2.10-sun4v.64bit-2.7/clib/librabbitmq/amqp_framing.o
gcc -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wstrict-prototypes -DHAVE_CONFIG_H -I/opt/app/myapp/software-ng/common/include -fPIC -Iclib/librabbitmq -Iclib -I/opt/app/myapp/software-ng/python/include/python2.7 -c clib/librabbitmq/amqp_hostcheck.c -o build/temp.solaris-2.10-sun4v.64bit-2.7/clib/librabbitmq/amqp_hostcheck.o
gcc -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wstrict-prototypes -DHAVE_CONFIG_H -I/opt/app/myapp/software-ng/common/include -fPIC -Iclib/librabbitmq -Iclib -I/opt/app/myapp/software-ng/python/include/python2.7 -c clib/librabbitmq/amqp_mem.c -o build/temp.solaris-2.10-sun4v.64bit-2.7/clib/librabbitmq/amqp_mem.o
gcc -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wstrict-prototypes -DHAVE_CONFIG_H -I/opt/app/myapp/software-ng/common/include -fPIC -Iclib/librabbitmq -Iclib -I/opt/app/myapp/software-ng/python/include/python2.7 -c clib/librabbitmq/amqp_socket.c -o build/temp.solaris-2.10-sun4v.64bit-2.7/clib/librabbitmq/amqp_socket.o
gcc -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wstrict-prototypes -DHAVE_CONFIG_H -I/opt/app/myapp/software-ng/common/include -fPIC -Iclib/librabbitmq -Iclib -I/opt/app/myapp/software-ng/python/include/python2.7 -c clib/librabbitmq/amqp_table.c -o build/temp.solaris-2.10-sun4v.64bit-2.7/clib/librabbitmq/amqp_table.o
gcc -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wstrict-prototypes -DHAVE_CONFIG_H -I/opt/app/myapp/software-ng/common/include -fPIC -Iclib/librabbitmq -Iclib -I/opt/app/myapp/software-ng/python/include/python2.7 -c clib/librabbitmq/amqp_tcp_socket.c -o build/temp.solaris-2.10-sun4v.64bit-2.7/clib/librabbitmq/amqp_tcp_socket.o
gcc -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wstrict-prototypes -DHAVE_CONFIG_H -I/opt/app/myapp/software-ng/common/include -fPIC -Iclib/librabbitmq -Iclib -I/opt/app/myapp/software-ng/python/include/python2.7 -c clib/librabbitmq/amqp_timer.c -o build/temp.solaris-2.10-sun4v.64bit-2.7/clib/librabbitmq/amqp_timer.o
gcc -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wstrict-prototypes -DHAVE_CONFIG_H -I/opt/app/myapp/software-ng/common/include -fPIC -Iclib/librabbitmq -Iclib -I/opt/app/myapp/software-ng/python/include/python2.7 -c clib/librabbitmq/amqp_url.c -o build/temp.solaris-2.10-sun4v.64bit-2.7/clib/librabbitmq/amqp_url.o
gcc -shared -L/opt/app/myapp/software-ng/common/lib -L/opt/app/myapp/software-ng/common/lib/sparcv9 -R/opt/app/myapp/software-ng/common/lib -R/opt/app/myapp/software-ng/common/lib/sparcv9 -L/opt/app/myapp/software-ng/common/lib -L/opt/app/myapp/software-ng/common/lib/sparcv9 -R/opt/app/myapp/software-ng/common/lib -R/opt/app/myapp/software-ng/common/lib/sparcv9 -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wstrict-prototypes -DHAVE_CONFIG_H -I/opt/app/myapp/software-ng/common/include build/temp.solaris-2.10-sun4v.64bit-2.7/Modules/_librabbitmq/connection.o build/temp.solaris-2.10-sun4v.64bit-2.7/clib/librabbitmq/amqp_api.o build/temp.solaris-2.10-sun4v.64bit-2.7/clib/librabbitmq/amqp_connection.o build/temp.solaris-2.10-sun4v.64bit-2.7/clib/librabbitmq/amqp_consumer.o build/temp.solaris-2.10-sun4v.64bit-2.7/clib/librabbitmq/amqp_framing.o build/temp.solaris-2.10-sun4v.64bit-2.7/clib/librabbitmq/amqp_hostcheck.o build/temp.solaris-2.10-sun4v.64bit-2.7/clib/librabbitmq/amqp_mem.o build/temp.solaris-2.10-sun4v.64bit-2.7/clib/librabbitmq/amqp_socket.o build/temp.solaris-2.10-sun4v.64bit-2.7/clib/librabbitmq/amqp_table.o build/temp.solaris-2.10-sun4v.64bit-2.7/clib/librabbitmq/amqp_tcp_socket.o build/temp.solaris-2.10-sun4v.64bit-2.7/clib/librabbitmq/amqp_timer.o build/temp.solaris-2.10-sun4v.64bit-2.7/clib/librabbitmq/amqp_url.o -o build/lib.solaris-2.10-sun4v.64bit-2.7/_librabbitmq.so
running install

Installing via pip, undefined symbol: clock_gettime

Installs cleanly. When I import librabbitmq, I get the following:

>>> import librabbitmq
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/librabbitmq/__init__.py", line 4, in <module>
    import _librabbitmq
ImportError: /usr/local/lib/python2.7/dist-packages/_librabbitmq.so: undefined symbol: clock_gettime

Listing linked shared objects doesn't contain librt.so:

$ ldd /usr/local/lib/python2.7/dist-packages/_librabbitmq.so
        linux-gate.so.1 =>  (0xb78bc000)
        libpthread.so.0 => /lib/i386-linux-gnu/tls/i686/nosegneg/libpthread.so.0 (0xb7880000)
        libc.so.6 => /lib/i386-linux-gnu/tls/i686/nosegneg/libc.so.6 (0xb7718000)
        /lib/ld-linux.so.2 (0xb78bd000)

Apologies if missing something obvious.

pip install fails on Fedora

Hello,

Attempting to install on F22 results in:

gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fno-strict-aliasing -O2 -g -pipe -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Iclib/librabbitmq -Iclib -I/usr/include/python2.7 -c clib/librabbitmq/amqp_socket.c -o build/temp.linux-x86_64-2.7/clib/librabbitmq/amqp_socket.o

    clib/librabbitmq/amqp_socket.c: In function 'amqp_login_inner':

    clib/librabbitmq/amqp_socket.c:1195:28: error: 'AMQ_PLATFORM' undeclared (first use in this function)

             amqp_cstring_bytes(AMQ_PLATFORM);

                                ^

    clib/librabbitmq/amqp_socket.c:1195:28: note: each undeclared identifier is reported only once for each function it appears in

    error: command 'gcc' failed with exit status 1


Any idea how I can fix this please?

Make error messages more clear

Currently librabbitmq prints error messages like this:

ConnectionError: Error opening socket: Unknown error: 536870973

Which are compound error messages created by bit-masking. This makes them impossible to search for in a search engine.

It would be much more clear if the error messages were printed as a string, or if the library at least provided a way to decode these messages.

Consumer occur Bad frame read

I use librabbitmq for consumer data from rabbitmq, but got Bad frame read exception

Traceback (most recent call last):
  File "consumer.py", line 119, in consume
    connection.drain_events()
  File "/home/push/python/lib/python2.6/site-packages/librabbitmq/__init__.py", line 198, in drain_events
    self._basic_recv(timeout)
ChannelError: Bad frame read

Python: 2.6
RabbitMQ: 3.1.3, Erlang R14B04
librabbitmq==1.0.1

Fails to build on OS X 10.10

Cannot build on OS X 10.10 (public preview 1). See alanxz/rabbitmq-c#206 for relevant issue.

$ make
rm -rf build
git submodule init
git submodule update
(cd rabbitmq-c; rm -rf codegen; ln -sf ../rabbitmq-codegen ./codegen)
(cd rabbitmq-c; test -f configure || autoreconf -i)
(cd rabbitmq-c; test -f Makefile  || automake --add-missing)
python setup.py build
running build
- generating 'clib/librabbitmq/amqp_framing.h'
/usr/local/opt/python/bin/python2.7 clib/librabbitmq/codegen.py header rabbitmq-codegen/amqp-rabbitmq-0.9.1.json clib/librabbitmq/amqp_framing.h
- generating 'clib/librabbitmq/amqp_framing.c'
/usr/local/opt/python/bin/python2.7 clib/librabbitmq/codegen.py body rabbitmq-codegen/amqp-rabbitmq-0.9.1.json clib/librabbitmq/amqp_framing.c
running build_py
creating build
creating build/lib.macosx-10.10-x86_64-2.7
creating build/lib.macosx-10.10-x86_64-2.7/funtests
copying funtests/__init__.py -> build/lib.macosx-10.10-x86_64-2.7/funtests
copying funtests/config.py -> build/lib.macosx-10.10-x86_64-2.7/funtests
copying funtests/disabled_basic_get_leak.py -> build/lib.macosx-10.10-x86_64-2.7/funtests
copying funtests/setup.py -> build/lib.macosx-10.10-x86_64-2.7/funtests
creating build/lib.macosx-10.10-x86_64-2.7/librabbitmq
copying librabbitmq/__init__.py -> build/lib.macosx-10.10-x86_64-2.7/librabbitmq
creating build/lib.macosx-10.10-x86_64-2.7/funtests/tests
copying funtests/tests/__init__.py -> build/lib.macosx-10.10-x86_64-2.7/funtests/tests
copying funtests/tests/test_channel_errors.py -> build/lib.macosx-10.10-x86_64-2.7/funtests/tests
running build_ext
building '_librabbitmq' extension
creating build/temp.macosx-10.10-x86_64-2.7
creating build/temp.macosx-10.10-x86_64-2.7/Modules
creating build/temp.macosx-10.10-x86_64-2.7/Modules/_librabbitmq
creating build/temp.macosx-10.10-x86_64-2.7/clib
creating build/temp.macosx-10.10-x86_64-2.7/clib/librabbitmq
clang -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fno-strict-aliasing -fno-common -dynamic -I/usr/local/include -I/usr/local/opt/sqlite/include -DNDEBUG -g -fwrapv -O3 -Wstrict-prototypes -DHAVE_CONFIG_H -Iclib/librabbitmq -Iclib -I/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c Modules/_librabbitmq/connection.c -o build/temp.macosx-10.10-x86_64-2.7/Modules/_librabbitmq/connection.o
Modules/_librabbitmq/connection.c:335:17: warning: using the result of an assignment as a condition without
      parentheses [-Wparentheses]
    while (item = PyIter_Next(iterator)) {
           ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
Modules/_librabbitmq/connection.c:335:17: note: place parentheses around the assignment to silence this
      warning
    while (item = PyIter_Next(iterator)) {
                ^
           (                           )
Modules/_librabbitmq/connection.c:335:17: note: use '==' to turn this assignment into an equality comparison
    while (item = PyIter_Next(iterator)) {
                ^
                ==
Modules/_librabbitmq/connection.c:380:1: warning: unused label 'error' [-Wunused-label]
error:
^~~~~~
2 warnings generated.
clang -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fno-strict-aliasing -fno-common -dynamic -I/usr/local/include -I/usr/local/opt/sqlite/include -DNDEBUG -g -fwrapv -O3 -Wstrict-prototypes -DHAVE_CONFIG_H -Iclib/librabbitmq -Iclib -I/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c clib/librabbitmq/amqp_api.c -o build/temp.macosx-10.10-x86_64-2.7/clib/librabbitmq/amqp_api.o
In file included from clib/librabbitmq/amqp_api.c:41:
clib/librabbitmq/amqp_private.h:335:1: error: expected ')'
DECLARE_XTOXLL(hton)
^
clib/librabbitmq/amqp_private.h:301:25: note: expanded from macro 'DECLARE_XTOXLL'
  _AMQP_INLINE uint64_t func##ll(uint64_t val)      \
                        ^
<scratch space>:141:1: note: expanded from here
htonll
^
/usr/include/sys/_endian.h:141:25: note: expanded from macro 'htonll'
#define htonll(x)       __DARWIN_OSSwapInt64(x)
                        ^
/usr/include/libkern/_OSByteOrder.h:78:30: note: expanded from macro '__DARWIN_OSSwapInt64'
    (__builtin_constant_p(x) ? __DARWIN_OSSwapConstInt64(x) : _OSSwapInt64(x))
                             ^
clib/librabbitmq/amqp_private.h:335:1: note: to match this '('
clib/librabbitmq/amqp_private.h:301:25: note: expanded from macro 'DECLARE_XTOXLL'
  _AMQP_INLINE uint64_t func##ll(uint64_t val)      \
                        ^
<scratch space>:141:1: note: expanded from here
htonll
^
/usr/include/sys/_endian.h:141:25: note: expanded from macro 'htonll'
#define htonll(x)       __DARWIN_OSSwapInt64(x)
                        ^
/usr/include/libkern/_OSByteOrder.h:78:5: note: expanded from macro '__DARWIN_OSSwapInt64'
    (__builtin_constant_p(x) ? __DARWIN_OSSwapConstInt64(x) : _OSSwapInt64(x))
    ^
In file included from clib/librabbitmq/amqp_api.c:41:
clib/librabbitmq/amqp_private.h:335:1: error: definition of builtin function '__builtin_constant_p'
DECLARE_XTOXLL(hton)
^
clib/librabbitmq/amqp_private.h:301:25: note: expanded from macro 'DECLARE_XTOXLL'
  _AMQP_INLINE uint64_t func##ll(uint64_t val)      \
                        ^
<scratch space>:141:1: note: expanded from here
htonll
^
/usr/include/sys/_endian.h:141:25: note: expanded from macro 'htonll'
#define htonll(x)       __DARWIN_OSSwapInt64(x)
                        ^
/usr/include/libkern/_OSByteOrder.h:78:6: note: expanded from macro '__DARWIN_OSSwapInt64'
    (__builtin_constant_p(x) ? __DARWIN_OSSwapConstInt64(x) : _OSSwapInt64(x))
     ^
In file included from clib/librabbitmq/amqp_api.c:41:
clib/librabbitmq/amqp_private.h:336:1: error: expected ')'
DECLARE_XTOXLL(ntoh)
^
clib/librabbitmq/amqp_private.h:301:25: note: expanded from macro 'DECLARE_XTOXLL'
  _AMQP_INLINE uint64_t func##ll(uint64_t val)      \
                        ^
<scratch space>:141:1: note: expanded from here
ntohll
^
/usr/include/sys/_endian.h:140:25: note: expanded from macro 'ntohll'
#define ntohll(x)       __DARWIN_OSSwapInt64(x)
                        ^
/usr/include/libkern/_OSByteOrder.h:78:30: note: expanded from macro '__DARWIN_OSSwapInt64'
    (__builtin_constant_p(x) ? __DARWIN_OSSwapConstInt64(x) : _OSSwapInt64(x))
                             ^
clib/librabbitmq/amqp_private.h:336:1: note: to match this '('
clib/librabbitmq/amqp_private.h:301:25: note: expanded from macro 'DECLARE_XTOXLL'
  _AMQP_INLINE uint64_t func##ll(uint64_t val)      \
                        ^
<scratch space>:141:1: note: expanded from here
ntohll
^
/usr/include/sys/_endian.h:140:25: note: expanded from macro 'ntohll'
#define ntohll(x)       __DARWIN_OSSwapInt64(x)
                        ^
/usr/include/libkern/_OSByteOrder.h:78:5: note: expanded from macro '__DARWIN_OSSwapInt64'
    (__builtin_constant_p(x) ? __DARWIN_OSSwapConstInt64(x) : _OSSwapInt64(x))
    ^
In file included from clib/librabbitmq/amqp_api.c:41:
clib/librabbitmq/amqp_private.h:336:1: error: definition of builtin function '__builtin_constant_p'
DECLARE_XTOXLL(ntoh)
^
clib/librabbitmq/amqp_private.h:301:25: note: expanded from macro 'DECLARE_XTOXLL'
  _AMQP_INLINE uint64_t func##ll(uint64_t val)      \
                        ^
<scratch space>:141:1: note: expanded from here
ntohll
^
/usr/include/sys/_endian.h:140:25: note: expanded from macro 'ntohll'
#define ntohll(x)       __DARWIN_OSSwapInt64(x)
                        ^
/usr/include/libkern/_OSByteOrder.h:78:6: note: expanded from macro '__DARWIN_OSSwapInt64'
    (__builtin_constant_p(x) ? __DARWIN_OSSwapConstInt64(x) : _OSSwapInt64(x))
     ^
4 errors generated.
error: command 'clang' failed with exit status 1
make: *** [build] Error 1

I updated the git submodule for rabbitmq-c to use the parent alanxz/rabbitmq-c instead of the ask/rabbitmq-c and merged after a git pull just to be absolutely sure and it still failed.

librabbitmq use of select() breaks support for large fds

Hello,

I've run into an issue when using rabbitmq in a service that has large numbers of file descriptors; Specifically our servers use async IO loops to handle many thousands of concurrent sockets. If in our life cycle we attempt to use librabbitmq (which we do a lot) we can easily crash our python interpreter because of unbound calls to select's FD_SET macro in RabbitMQ_wait_timeout(). Here is a piece of code that will crash python.

import unittest
import socket
from librabbitmq import Connection

class LargeFileDesc(unittest.TestCase):

    def test_large_fd(self):
         sockets = [ socket.socket() for x in range(10000) ]
         c = Connection()
         c.drain_events(timeout=0.001)

if __name__ == '__main__':
    unittest.main()

Note that you'll need to bump your max number of open files allowed with ulimit -n 100000 which requires root privileges. On OSX you have to tweak some sysctl values too I think. I'm currently working on a GNU/Linux distro.

As for possible fixes, I can't think of anything elegant other than doing feature detection for poll() during the build and relegating non-POSIX systems to the inherit limits of select(); Unless librabbitmq is only designed for POSIX systems and then i'd be willing to submit a patch that just replaces select() with poll().

Please advise if the poll() replacement would be acceptable to librabbitmq's platform requirements.

JM

queue_unbind signature does not match py-amqp

I'm trying to use the kombu Queue.unbind_from method which calls either py-amqp or librabbitmq's Channel.queue_unbind method. In the case of librabbitmq I get a TypeError because the expected signature does not match the calling form or that of py-amqp; Namely librabbitmq is expecting the kwarg 'binding_key' instead of 'routing_key'.

Here is py-ampq:

def queue_unbind(self, queue, exchange, routing_key='', nowait=False, arguments=None):

vs librabbitmq:

def queue_unbind(self, queue='', exchange='', binding_key='', arguments=None, nowait=False):

From what I can tell these interfaces are expected to be the same(ish), so perhaps this is a bug? If I'm mistaken about the intent to match these interfaces then this is probably a bug for kombu and it will need an abstraction to cope with the varied Channel interfaces.

KeyError('properties',) in Channel.basic_get

Using celery I found out in the log file several error like this one:

 Task celery.chord_unlock with id 549c898e-ed49-4e7d-8b31-8bcf5c541f46 raised exception:
 "KeyError('properties',)"


 Task was called with args: ('0183df27-0cb3-4da4-8f2c-948d0e70cb88', suggestion.attachImages(<Suggestion: s625724>)) kwargs: {'max_retries': None, 'interval': 1, 'propagate': False, 'result': ['873ae99b-7763-458f-a817-6bde5eb1594a']}.

The contents of the full traceback was:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/celery/task/trace.py", line 228, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/celery/task/trace.py", line 415, in __protected_call__
    return self.run(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/celery/app/builtins.py", line 95, in unlock_chord
    if deps.ready():
  File "/usr/local/lib/python2.7/dist-packages/celery/result.py", line 375, in ready
    return all(result.ready() for result in self.results)
  File "/usr/local/lib/python2.7/dist-packages/celery/result.py", line 375, in <genexpr>
    return all(result.ready() for result in self.results)
  File "/usr/local/lib/python2.7/dist-packages/celery/result.py", line 169, in ready
    return self.state in self.backend.READY_STATES
  File "/usr/local/lib/python2.7/dist-packages/celery/result.py", line 272, in state
    return self.backend.get_status(self.id)
  File "/usr/local/lib/python2.7/dist-packages/celery/backends/base.py", line 295, in get_status
    return self.get_task_meta(task_id)['status']
  File "/usr/local/lib/python2.7/dist-packages/celery/backends/amqp.py", line 163, in get_task_meta
    prev, latest, acc = latest, acc, binding.get(no_ack=False)
  File "/usr/local/lib/python2.7/dist-packages/kombu/entity.py", line 554, in get
    message = self.channel.basic_get(queue=self.name, no_ack=no_ack)
  File "/usr/local/lib/python2.7/dist-packages/librabbitmq/__init__.py", line 67, in basic_get
    frame['properties'],
KeyError: 'properties'

This error appears only randomly and disappear using py-amqp thus I think the problem is with librabbitmq.
Modifying the li near the 67 librabbitmq/init.py in this way:

try:
    return(self.Message(self,
                    frame['properties'],
                    frame['delivery_info'],
                    frame['body']))
except:
    raise Exception(frame)

I get this error log:

Task celery.chord_unlock with id 39cc3448-34f2-4e79-af55-0cf2f519143e raised exception:
"Exception({'delivery_info': {'redelivered': False, 'exchange': 'celeryresults', 'routing_key': 'acb84c28c0034f6f9f159fa287c7624d', 'delivery_tag': 10L}},)"


Task was called with args: ('f5914b37-7fde-4842-8b81-21a2602a1879', suggestion.attachImages(<Suggestion: s625811>)) kwargs: {'max_retries': None, 'interval': 1, 'propagate': False, 'result': ['acb84c28-c003-4f6f-9f15-9fa287c7624d']}.

The contents of the full traceback was:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/celery/task/trace.py", line 228, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/celery/task/trace.py", line 415, in __protected_call__
    return self.run(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/celery/app/builtins.py", line 95, in unlock_chord
    if deps.ready():
  File "/usr/local/lib/python2.7/dist-packages/celery/result.py", line 375, in ready
    return all(result.ready() for result in self.results)
  File "/usr/local/lib/python2.7/dist-packages/celery/result.py", line 375, in <genexpr>
    return all(result.ready() for result in self.results)
  File "/usr/local/lib/python2.7/dist-packages/celery/result.py", line 169, in ready
    return self.state in self.backend.READY_STATES
  File "/usr/local/lib/python2.7/dist-packages/celery/result.py", line 272, in state
    return self.backend.get_status(self.id)
  File "/usr/local/lib/python2.7/dist-packages/celery/backends/base.py", line 295, in get_status
    return self.get_task_meta(task_id)['status']
  File "/usr/local/lib/python2.7/dist-packages/celery/backends/amqp.py", line 163, in get_task_meta
    prev, latest, acc = latest, acc, binding.get(no_ack=False)
  File "/usr/local/lib/python2.7/dist-packages/kombu/entity.py", line 554, in get
    message = self.channel.basic_get(queue=self.name, no_ack=no_ack)
  File "/usr/local/lib/python2.7/dist-packages/librabbitmq/__init__.py", line 73, in basic_get
    raise Exception(frame)
Exception: {'delivery_info': {'redelivered': False, 'routing_key': 'acb84c28c0034f6f9f159fa287c7624d', 'delivery_tag': 10L, 'exchange': 'celeryresults'}}

Checking the queue with rabbitmqctl list_queues shows that the queue still contain a message but trying to read it using librabbitmq from the python console yield no results. The issue appears randomly (let's say every 10 tasks launched) and only on the production environment (so the testing activity is limited).
The server is a Debian Wheezy with all the patch installed and the configuration is:
Django==1.4.5
MySQL-python==1.2.3
PIL==1.1.7
South==0.7.5
amqp==1.0.11
billiard==2.7.3.28
boto==2.3.0
celery==3.0.19
dnspython==1.10.0
docutils==0.8.1
eventlet==0.12.1
flower==0.4.2
greenlet==0.4.0
httplib2==0.7.7
ipython==0.13.1
jsonfield==0.9.13
kombu==2.5.10
librabbitmq==1.0.1
passlib==1.6.1
pexpect==2.4
pytz==2012c
redis==2.4.13
simplegeneric==0.8.1
simplejson==3.0.7
six==1.3.0
And is identical to test environment where the issues never happened. The issue appeared when we added an eventlet node to the celery configuration but disabling it has not solved the issue.

I don't konw if it could be useful for debugging but we start seeing also another error on a task on the get result of a starmap.

Task tnlibs.celery.sel_utilities.keySelection with id 1ebc0eb9-da2c-40f8-8ccb-06dc765d9ab3 raised exception:
"ChannelError('Bad frame read',)"
Task was called with args: ({1200128L: {'content': u" ... [details removed]

The contents of the full traceback was:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/celery/task/trace.py", line 228, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/tndj-0.1.dev_r2287-py2.7.egg/tnlibs/celery/tncelery.py", line 17, in __call__
    return super(TNTask,self).__call__(*args,**kwargs)
  File "/usr/local/lib/python2.7/dist-packages/celery/task/trace.py", line 415, in __protected_call__
    return self.run(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/tndj-0.1.dev_r2287-py2.7.egg/tnlibs/celery/sel_utilities.py", line 335, in keySelection
    r.get()
  File "/usr/local/lib/python2.7/dist-packages/celery/result.py", line 449, in get
    timeout=timeout, propagate=propagate, interval=interval)
  File "/usr/local/lib/python2.7/dist-packages/celery/result.py", line 531, in join_native
    interval=interval):
  File "/usr/local/lib/python2.7/dist-packages/celery/backends/amqp.py", line 232, in get_many
    r = self.drain_events(conn, consumer, timeout)
  File "/usr/local/lib/python2.7/dist-packages/celery/backends/amqp.py", line 202, in drain_events
    wait(timeout=timeout)
  File "/usr/local/lib/python2.7/dist-packages/librabbitmq/__init__.py", line 202, in drain_events
    self._basic_recv(timeout)
ChannelError: Bad frame read

I'm not sure if this last error is related but it has also disappeared using py-amqp (even if this task is called only few times so I'm not totally sure this problem is solved).

calling message.decode() in a comprehension throws a DecodeError exception

Had a weird issue today. I have a method that empties a rabbitmq Queue and processes all the messages (for batch processing). I installed librabbitmq and the method started failing.

Exception:

File "/usr/lib/python2.7/contextlib.py", line 35, in exit
self.gen.throw(type, value, traceback)
File "/usr/local/lib/python2.7/dist-packages/kombu/serialization.py", line 59, in _reraise_errors
reraise(wrapper, wrapper(exc), sys.exc_info()[2])
File "/usr/local/lib/python2.7/dist-packages/kombu/serialization.py", line 55, in _reraise_errors
yield
File "/usr/local/lib/python2.7/dist-packages/kombu/serialization.py", line 184, in loads
return decode(data)
File "/usr/local/lib/python2.7/dist-packages/kombu/serialization.py", line 64, in pickle_loads
return load(BytesIO(s))
DecodeError

I was able to trim it down pretty far so just the following code snippet threw the exception...

for i in xrange(100):
    messages.append(q.get(timeout=.1))
'\n'.join([message.decode()['args'][0] for message in messages])

While doing it this way does not...

for i in xrange(100):
    message = q.get(timeout=.1)
    messages.append(message)
    contents.append(message.decode()['args'][0])
'\n'.join(contents)

Not sure if I am missing something obvious, but wanted to report it here just in case.

Wrong sending timestamp

I try to send timestamp value with message but it is rounded to 255. If i sent 256 I'll receive 0, 257 - 1, 258 - 2 etc.
in librabbitmq/Modules/_librabbitmq/connection.c
I see setting timestamp as long:

    if (props->_flags & AMQP_BASIC_TIMESTAMP_FLAG) {
        value = PyInt_FromLong(props->timestamp);
        PyDICT_SETSTR_DECREF(p, "timestamp", value);
    }

and getting it with casting to uint8_t type:

    if ((value = PyDict_GetItemString(p, "timestamp")) != NULL) {
        props->timestamp = (uint8_t)PyInt_AS_LONG(value);
        props->_flags |= AMQP_BASIC_TIMESTAMP_FLAG;
    }

I suppose this casting to uint8_t is a reason of my issue. Is it right behavior for timestamp property in message?

Is it a dual license?

Hi @ask, I would like to use this package, but the license situation is a bit confusing:

The repo contains two licenses:

  1. LICENSE-GPL-2.0
  2. LICENSE-MPL-RabbitMQ

However, both README.rst and PyPi https://pypi.python.org/pypi/librabbitmq#license both make it seem like it's a single MPL license:

This software is licensed under the Mozilla Public License. See the LICENSE-MPL-RabbitMQ file in the top distribution directory for the full license text.

Could you possibly clarify the licensing terms as soon as possible? The MPL license is not compatible with my app, while GPL-2.0 would be compatible.

Many thanks,
Vitaly

Including librabbitmq-c necessary?

No really an issue, but is there any rationale on why librabbitmq-c is included in the source?
Why not make the installation of the c-library a dependency? The current situation requires quite a lot of changes to your build process if someone (me) wants to shape this into a Debian package.

Memory Leaks from 'Maybe_Unicode'

I've been looking into a memory leak by running a static analysis tool over the librabbitmq module. It looks like the way Maybe_Unicode is being used may leak object references.

_PYRMQ_INLINE PyObject*
Maybe_Unicode(PyObject *s)
{
    if (PyUnicode_Check(s))
        return PyUnicode_AsASCIIString(s);
    return s;
}

I see it called often after a call to PyArg_ParseTuple

The docs for PyArg_ParseTuple say:

Note that any Python object references which are provided to the caller are borrowed references; do not decrement their reference count!

The docs for PyUnicode_AsASCIIString say:

PyObject* PyUnicode_AsASCIIString(PyObject *unicode)
Return value: New reference.

If Maybe_Unicode is intended to make new objects, the caller needs to be responsible for cleaning them up.
If the caller calls Maybe_Unicode with a borrowed reference, but gets back a new reference, it should decrement the refcount once it's done, but I haven't seen any evidence of that.

It may be cleaner to increment the refcount before calling, and decrement it when you're done, so that Maybe_Unicode can safely decrement the ref to a passed unicode object. e.g:

_PYRMQ_INLINE PyObject*
Maybe_Unicode(PyObject *s)
{
    if (PyUnicode_Check(s))
    {
        PyObject* ascii = PyUnicode_AsASCIIString(s);
        DECREF(s);
        s = ascii;
    }
    return s;
}

Accept a Connection socket_timeout

pylibrabbitmq does not appear to accept a socket_timeout like amqplib and other transports do, resulting in the following unexpected ConnectionError.

With librabbitmq:

librabbitmq/init.pyc in init(self, host, userid, password, virtual_host, port, channel_max, frame_max, heartbeat, lazy, **kwargs)
166 self._avail_channel_ids = array('H', xrange(self.channel_max, 0, -1))
167 if not lazy:
--> 168 self.connect()
169
170 def reconnect(self):

ConnectionError: Error opening socket: Unknown error: 536870972

With amqplib:

amqplib/client_0_8/transport.pyc in init(self, host, connect_timeout)
83 if not self.sock:
84 # Didn't connect, return the most recent error message

---> 85 raise socket.error, msg
86
87 self.sock.settimeout(None)

timeout: timed out

Running kombu 2.4.6 with librabbitmq: calls to .delay() and .apply_async()
that time out no longer timeout in the amount of time set with BROKER_CONNECTION_TIMEOUT
as they did with amqplib.

librabbitmq build fails on OS X Lion

Installation of librabbitmq fails with the message below. This happens when installing using pip (pip install librabbitmq==0.9.9) and when using the development version (ref f29317e).

/usr/bin/clang -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fno-strict-aliasing -fno-common -dynamic -Os -w -pipe -march=native -Qunused-arguments -mmacosx-version-min=10.7 -fwrapv -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -W -Wall -ansi -Iclib/librabbitmq -Iclib -Iclib/librabbitmq/unix -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c clib/librabbitmq/amqp_api.c -o build/temp.macosx-10.7-x86_64-2.7/clib/librabbitmq/amqp_api.o
clib/librabbitmq/amqp_api.c:33:10: fatal error: 'config.h' file not found
#include "config.h"
         ^
1 error generated.
error: command '/usr/bin/clang' failed with exit status 1
make: *** [build] Error 1

(Full log)

I propose adding (cd clib; test -f clib/config.h || ./configure) to the Makefile's dist target. This will generate the needed config.h file and the build will succeed.

Windows install fails

Fresh install of Windows 7, python2.6.4, gnuwin32 and git. All working i.e. %path% is correct.

pip install librabbitmq & easy_install librabbitmq result in the same thing. As does getting the latest via git (librabbitmq-master)..

I normally get "no module named librabbitmq" but if i install from git I get "no module named _librabbitmq". Basically the only files that get copied into my site-packages directory are the informational egg directory.

Any ideas?

Error opening socket: a socket error occurred <class '_librabbitmq.ConnectionError'>

I'm experiencing a socket error and traceback points to librabbitmq. Any ideas will be greatly appreciated.

File "/home/user/.virtualenvs/avofis/lib/python2.7/site-packages/celery/app/task.py", line 453, in delay
 return self.apply_async(args, kwargs)
...
File "/home/user/.virtualenvs/avofis/lib/python2.7/site-packages/librabbitmq/__init__.py", line 199, in __init__
  self.connect()
ConnectionError: Error opening socket: a socket error occurred

Installed the librabbitmq via pip. Version I'm using is 1.6.1

I can confirm that RabbitMQ is running, celery is running, erlang is running. Celery, RabbitMq looks like connected, no connection errors in logs. However when I call some_task.delay() in a django view I get the error above exception within a django view.

setup causes: "warning: no files found matching '*' under directory 'tests'"

Other warnings/errors include:
no previously-included directories found matching '.pyc' {:level=>:error}
no previously-included directories found matching '
.o' {:level=>:error}
no previously-included directories found matching '.la' {:level=>:error}
no previously-included directories found matching '
.so' {:level=>:error}
no previously-included directories found matching '*.dylib' {:level=>:error}

Possible fix #1: MANIFEST.in prune *.xyz lines should be converted to recursive-exclude [dir] *.xyz (prune is for directories and recursive-exclude is for files.

Possible fix #2: Since the 'tests' folder is under librabbitmq/tests, can we just remove the following line from MANIFEST.in?

recursive-include tests *

Channel does not support events

The kombu Producer code expects the librabbitmq.Channel class to have an events attribute used to listen for events such as NO_ROUTE (on_return) when a message is sent with immediate=True. The amqp module implements this correctly but librabbitmq does not have an events dict and thus produces the following exception with kombu.Producer(on_return=lambda *foo). As I understand it the APIs should be the same and so I figure this is a librabbitmq issue and not kombu.

  File "/local/home/mayfield/project/wpc/mayfield-rome/packages_venv/lib/python2.7/site-packages/kombu/messaging.py", line 83, in __init__
    self.revive(self._channel)
  File "/local/home/mayfield/project/wpc/mayfield-rome/packages_venv/lib/python2.7/site-packages/kombu/messaging.py", line 208, in revive
    self._channel.events['basic_return'].add(self.on_return)
AttributeError: 'Channel' object has no attribute 'events'

snprintf now part of ansi-c

Modules/_librabbitmq/connection.c makes use of snprintf. However, librabbitmq is built with the -ansi flag. The -ansi version of c does not have snprintf. It may still build using some compilers if you enable implicit declarations. Post-build checks for implicit declarations reject it.

Either using something other than snprintf or building with something other than -ansi will fix this problem.

librabbitmq fails to install

ubuntu 12.04.1

Same results with easy install and pip. From source also fails. No meaningful info anywhere.

E.g. with pip and easy install:

Searching for librabbitmq
Reading http://pypi.python.org/simple/librabbitmq/
Reading http://github.com/celery/librabbitmq
Best match: librabbitmq 1.0.1
Downloading http://pypi.python.org/packages/source/l/librabbitmq/librabbitmq-1.0.1.tar.gz#md5=7350f2018d789116e861a9e1a83e2e86
Processing librabbitmq-1.0.1.tar.gz
Running librabbitmq-1.0.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-L0TLf1/librabbitmq-1.0.1/egg-dist-tmp-HE8dxR
warning: no files found matching '*' under directory 'tests'
no previously-included directories found matching '*.pyc'
no previously-included directories found matching '*.o'
no previously-included directories found matching '*.la'
no previously-included directories found matching '*.so'
no previously-included directories found matching '*.dylib'
warning: install_lib: 'build/lib.linux-x86_64-2.7' does not exist -- no Python modules to install

Adding librabbitmq 1.0.1 to easy-install.pth file

Installed /usr/local/lib/python2.7/dist-packages/librabbitmq-1.0.1-py2.7.egg
Processing dependencies for librabbitmq
Finished processing dependencies for librabbitmq

Looks fine. Except there was no compilation done. Python: import librabbitmq:
ImportError: No module named librabbitmq

Could it have anything to do with me using rabbitmq 3.0.1 (latest stable)?

Installing as install_requires via setup.py fails.

Environment: OS X 10.8.5, Python 2.7.2

installing directly via pip command works well as expected, but installing via setup.py develop as specifying librabbitmq as install_requires causes an error. the last part of error is:

clang: warning: argument unused during compilation: '-mno-fused-madd'
clib/librabbitmq/amqp_mem.c:46:10: error: use of undeclared identifier 'VERSION'
  return VERSION; /* defined in config.h */
         ^
1 error generated.
error: Setup script exited with error: command 'clang' failed with exit status 1

i've tried specifying librabbitmq in setup_requires, but it generated same result. how can i fix this situation? i want to get rid of calling pip install -r requirements.txt from my application.

Bad Frame Read

Just upgraded to librabbitmq 1.5.2 and celery 3.1.12

I'm getting a failure during one of my tasks that involves a large chord.

Stacktrace (most recent call last):

  File "celery/app/trace.py", line 240, in trace_task
    R = retval = fun(*args, **kwargs)
  File "newrelic/hooks/application_celery.py", line 66, in wrapper
    return wrapped(*args, **kwargs)
  File "celery/app/trace.py", line 437, in __protected_call__
    return self.run(*args, **kwargs)
  File "celery/app/builtins.py", line 75, in unlock_chord
    if deps.ready():
  File "celery/result.py", line 499, in ready
    return all(result.ready() for result in self.results)
  File "celery/result.py", line 499, in 
    return all(result.ready() for result in self.results)
  File "celery/result.py", line 255, in ready
    return self.state in self.backend.READY_STATES
  File "celery/result.py", line 390, in state
    return self._get_task_meta()['status']
  File "celery/result.py", line 328, in _get_task_meta
    meta = self.backend.get_task_meta(self.id)
  File "celery/backends/amqp.py", line 173, in get_task_meta
    accept=self.accept, no_ack=False,
  File "kombu/entity.py", line 570, in get
    message = self.channel.basic_get(queue=self.name, no_ack=no_ack)
  File "librabbitmq/__init__.py", line 65, in basic_get
    frame = self.connection._basic_get(self.channel_id, queue, no_ack)

Task celery.chord_unlock[a360ea41-91c0-4dec-b95f-c1baa3874ce4] raised unexpected: ConnectionError('Bad frame read',)

This seems like it might be related to #30

"Bad frame read" when message with empty body received

I've tested this with the latest version of https://github.com/celery/librabbitmq from pip and https://github.com/alanxz/rabbitmq-c and it seems to be current.

How to replicate:

  • create consumer and bind to any type of exchange(I've noticed it with headers, but it happends with any type of exchange)
  • send one or more message with an empty body
  • traceback should appear

This does happen only when message body is "". Even single white space prevents it from happening.

2014-08-07 11:40:42,742 ERROR      Thread-1    Traceback (most recent call last):
  File "/scratch/icflix-monitoring-robots/lib/amqp_consumer.py", line 120, in run
    self._connection.drain_events(0.01)
  File "/usr/lib/python2.7/dist-packages/librabbitmq/__init__.py", line 198, in drain_events
    self._basic_recv(timeout)
ChannelError: Bad frame read

RabbitMQ log

=WARNING REPORT==== 7-Aug-2014::11:28:44 ===
closing AMQP connection <0.5547.0> (192.168.253.9:56556 -> 192.168.253.11:5672):
connection_closed_abruptly

_librabbitmq.so problem on OS X Lion with versions greater than 0.9.2

When I try to install a version of librabbitmq greater than 0.9.2 on my Mac (OS X 10.7.4) using PIP, the library installs fine, but when I try to import it in a python program or the interpreter, I get the following error.

program:

Traceback (most recent call last):
File "test.py", line 4, in
import rabbit
File "/Users/phadviger/code/librabbitmq/rabbit.py", line 2, in
import librabbitmq
File "/Library/Python/2.7/site-packages/librabbitmq/init.py", line 4, in
import _librabbitmq
ImportError: dlopen(/Library/Python/2.7/site-packages/_librabbitmq.so, 2): Symbol not found: _PyDict_ToAMQTable
Referenced from: /Library/Python/2.7/site-packages/_librabbitmq.so
Expected in: flat namespace
in /Library/Python/2.7/site-packages/_librabbitmq.so

interpreter:
$ python
Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

import librabbitmq
Traceback (most recent call last):
File "", line 1, in
File "/Library/Python/2.7/site-packages/librabbitmq/init.py", line 4, in
import _librabbitmq
ImportError: dlopen(/Library/Python/2.7/site-packages/_librabbitmq.so, 2): Symbol not found: _PyDict_ToAMQTable
Referenced from: /Library/Python/2.7/site-packages/_librabbitmq.so
Expected in: flat namespace
in /Library/Python/2.7/site-packages/_librabbitmq.so

Version 0.9.2 installs and works flawlessly though, but I would really like to use some of the changes in the newer versions.

Let me know if you need additional info.

Memory leak when publishing with same channel, librabbitmq 1.0.3

Hi,

I ran into an issue when I use channels again and again to publish. I know a similar issue was fixed in 1.0.1 but I am still seeing a memory leak even with that version.

I attached some code to reproduce the problem:

import librabbitmq
conn = librabbitmq.Connection(host='localhost', port=5673, userid='guest', password='guest', virtual_host='/')
channel = conn.channel()
# using headers seems to amplify the problem.
properties = {'headers': {'someHeader': 'someValue', 'someHeader1': 'someValue', 'someHeader2': 'someValue', 'someHeader3': 'someValue', 'someHeader4': 'someValue'}}
for _ in xrange(100000):
  channel.basic_publish('123', **properties)

Running the xrange loop a couple of times should show you the memory increasing.

I had a bit of a dig inside the bindings and googling for potential memory leaks inside rabbitmq-c and came across the following link:
http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/2013-July/028212.html

Where they mention calling:
amqp_maybe_release_buffers after amqp_tx_commit. I had a look around the basic_publish method in the bindings but didn't come across any amqp_tx_commits but adding in amqp_maybe_release_buffers in the connection.c (https://github.com/celery/librabbitmq/blob/master/Modules/_librabbitmq/connection.c) file seems to solve the issue.

ret = amqp_basic_publish(self->conn, channel,
                             PyString_AS_AMQBYTES(exchange),
                             PyString_AS_AMQBYTES(routing_key),
                             (amqp_boolean_t)mandatory,
                             (amqp_boolean_t)immediate,
                             &props,
                             bytes);
    amqp_maybe_release_buffers(self->conn);
    Py_END_ALLOW_THREADS;

I didn't submit a pull request as I am not 100% sure this is the right approach for this problem as I am not too familiar with rabbitmq-c but thought I'd flag this and submit a potential fix.

Thanks,
Jozef

error return without exception set in 1.5

Hey,

I ran my test suit on the new library, and I am getting SystemError exception when for example providing an invalid DNS entry or a bad ip/port.

  File "/usr/local/lib/python2.7/dist-packages/librabbitmq/__init__.py", line 184, in __init__
    self.connect()
SystemError: error return without exception set

These are the tests that are failing with invalid exceptions

self.assertRaises(AMQPConnectionError,
                          self.adapter.Connection, '127.0.0.0')
self.assertRaises(AMQPConnectionError,
                          self.adapter.Connection, HOSTNAME,
                          port=1337)
self.assertRaises(AMQPConnectionError,
                          self.adapter.Connection, '127.0.0.0')

I have my own API wrapped around librabbitmq, but I am making very simple calls.

connection = librabbitmq.Connection
self._connection = connection(hostname,
                              port=port,
                              userid=username,
                              password=password,
                              virtual_host=virtual_host,
                              confirm_publish=confirm_publish)

Bump version to 1.0.3?

I noticed on that ChangeLog that the files don't seem to match on PyPi https://pypi.python.org/packages/source/l/librabbitmq/librabbitmq-1.0.3.tar.gz)

diff Changelog ../librabbitmq-src/librabbitmq-1.0.3/Changelog 

9a10,29
> .. _version-1.0.3:
> 
> 1.0.3
> =====
> :release-date: 2013-11-15 11:00 P.M UTC
> 
> - Fixed installation problem on OS X 10.9
> 
> .. _version-1.0.2:
> 
> 1.0.2
> =====
> :release-date: 2013-10-25 11:00 P.M UTC
> 
> - "Bad Frame Read" is now ConnectionError, not ChannelError.
> 
> - Fixed problem with basic_cancel when disconnected.
> 
> - Fixed typo Channel.recover -> Channel.basic_recover
> 
10a31,34
> 
> 1.0.1
> =====
> :release-date: 2013-01-14 02:10 P.M UTC

pip install librabbitmq fails because of removing -Wall

Here's the pip install log. This is on Fedora 21 with gcc 4.9.2

$ pip install librabbitmq
Collecting librabbitmq
  Using cached librabbitmq-1.6.1.tar.gz
Requirement already satisfied (use --upgrade to upgrade): amqp>=1.4.6 in /home/aron/.virtualenvs/pp/lib/python2.7/site-packages (from librabbitmq)
Installing collected packages: librabbitmq
  Running setup.py install for librabbitmq
    Complete output from command /home/aron/.virtualenvs/pp/bin/python2 -c "import setuptools, tokenize;__file__='/tmp/pip-build-EmpTYQ/librabbitmq/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-tb1kGg-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/aron/.virtualenvs/pp/include/site/python2.7/librabbitmq:
    running build
    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether build environment is sane... yes
    checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
    checking for gawk... gawk
    checking whether make sets $(MAKE)... yes
    checking whether make supports nested variables... yes
    checking whether make supports nested variables... (cached) yes
    checking for style of include used by make... GNU
    checking for gcc... gcc
    checking whether the C compiler works... no
    configure: error: in `/tmp/pip-build-EmpTYQ/librabbitmq/clib':
    configure: error: C compiler cannot create executables
    See `config.log' for more details
...

Here is what we see in config.log

configure:3333: checking whether the C compiler works
configure:3355: gcc -fno-strict-aliasing -O2 -g -pipe  -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches  -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv  -DNDEBUG -O2 -g -pipe  -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches  -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv  -Wl,-z,relro conftest.c  >&5
cc1: error: -Wformat-security ignored without -Wformat [-Werror=format-security]

I found that this can be avoided by dropping the line in setup.py that removes -Wall from the command-line.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.