[Pgtreats-users] Getting started: unable to publish using pg_amqp

Michael Glaesemann michael.glaesemann at myyearbook.com
Fri Aug 20 10:53:01 EDT 2010


I'm trying out pg_amqp trunk with RabbitMQ 1.8.1 and Postgres 8.4.4 on Mac OS X 10.6.4. (version info at the bottom).
I'm having trouble publishing messages.

I have confirmed that the rabbitmq server allows both publishing and consuming via a couple of simple Ruby scripts acting as publisher and client.

I can see via rabbitmqctl list_connections that I have a connection from postgres (as there is no other code connected to rabbitmq and there is one connection listed).

amqp=# select * from amqp.broker;
 broker_id |   host    | port | vhost | username | password 
         1 | localhost | 5672 |       | guest    | guest
(1 row)

However, when publishing via pg_amqp, I am not able to pull anything off the queue.

amqp=# select amqp.autonomous_publish(1, 'mapy', null, 'hi there!');
(1 row)

amqp=# select amqp.publish(1, 'mapy', null, 'hi there!');
WARNING:  amqp could not commit tx mode on broker 1
(1 row)

Also interestingly, I can crash postgres using amqp.declare_exchange:

amqp=# select amqp.exchange_declare(1, 'mapy', 'fanout', false, false, false);
server closed the connection unexpectedly
	This probably means the server terminated abnormally
	before or while processing the request.
The connection to the server was lost. Attempting reset: LOG:  server process (PID 55392) was terminated by signal 11: Segmentation fault
LOG:  terminating any other active server processes
FATAL:  the database system is in recovery mode
!> LOG:  all server processes terminated; reinitializing
LOG:  database system was interrupted; last known up at 2010-08-19 20:07:58 EDT
LOG:  database system was not properly shut down; automatic recovery in progress
LOG:  record with zero length at 0/52C590
LOG:  redo is not required
LOG:  database system is ready to accept connections
LOG:  autovacuum launcher started

In gdb I was able to get this output:
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000341
pg_amqp_exchange_declare (fcinfo=0x1) at pg_amqp.c:227
227	  if(!PG_ARGISNULL(0)) {

Any insight appreciated!

Michael Glaesemann
michael.glaesemann at myyearbook.com

$ svn info
Path: .
URL: https://labs.omniti.com/pgtreats/trunk/contrib/pg_amqp
Repository Root: https://labs.omniti.com/pgtreats
Repository UUID: 062c93da-48c3-e3cf-b31f-a9c212c88a84
Revision: 180
Node Kind: directory
Schedule: normal
Last Changed Author: jesus
Last Changed Rev: 79
Last Changed Date: 2009-12-23 15:53:38 -0500 (Wed, 23 Dec 2009)

$ sudo rabbitmqctl status
Status of node rabbit at laughter ...
                        {mnesia,"MNESIA  CXC 138 12","4.4.14"},
                        {os_mon,"CPO  CXC 138 46","2.2.5"},
                        {sasl,"SASL  CXC 138 11",""},
                        {stdlib,"ERTS  CXC 138 10","1.17"},
                        {kernel,"ERTS  CXC 138 10","2.14"}]},
 {nodes,[{disc,[rabbit at laughter]}]},
 {running_nodes,[rabbit at laughter]}]

amqp=# select version();
 PostgreSQL 8.4.4 on i386-apple-darwin10.4.0, compiled by GCC i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5664), 64-bit
(1 row)

More information about the Pgtreats-users mailing list