Subject: | publish with no exchange specified fails |
Hi
Due to an uninitialized value, the publish method with no exchange
parameter may fail. The failure is caused by CHECK_LIMIT returning
EFAULT, called from
amqp_basic_publish
-> amqp_send_method
-> amqp_send_frame
-> inner_send_frame
-> amqp_encode_method
The attached patch fixes it by initializing exchange_b to a null pointer
- I'm not sure if this is the most correct fix, but it works for me.
The following test script reproduces the problem for me on Debian 64-bit:
#!/usr/bin/perl
use Net::RabbitMQ;
my $mq = Net::RabbitMQ->new();
$mq->connect("localhost", { user => "guest", password => "guest" });
$mq->channel_open(1);
$mq->queue_declare(1, "queuename");
$ret = $mq->publish(1, "queuename", "blah");
$mq->disconnect();
however, it works fine on Centos 32-bit, so it perhaps depends on the
underlying OS and how memory is initialized by default.
cheers
-ben
Subject: | net-rabbitmq-exchange.patch |
Only in Net-RabbitMQ-0.1.5: amqp_api.o
Only in Net-RabbitMQ-0.1.5: amqp_connection.o
Only in Net-RabbitMQ-0.1.5: amqp_debug.o
Only in Net-RabbitMQ-0.1.5: amqp_framing.o
Only in Net-RabbitMQ-0.1.5: amqp_mem.o
Only in Net-RabbitMQ-0.1.5: amqp_socket.o
Only in Net-RabbitMQ-0.1.5: amqp_table.o
Only in Net-RabbitMQ-0.1.5: blib
Only in Net-RabbitMQ-0.1.5: Makefile
Only in Net-RabbitMQ-0.1.5: pm_to_blib
Only in Net-RabbitMQ-0.1.5: RabbitMQ.bs
Only in Net-RabbitMQ-0.1.5: RabbitMQ.c
Only in Net-RabbitMQ-0.1.5: RabbitMQ.o
diff -ur Net-RabbitMQ-0.1.5/RabbitMQ.xs Net-RabbitMQ-0.1.5.orig/RabbitMQ.xs
--- Net-RabbitMQ-0.1.5/RabbitMQ.xs 2010-06-01 12:37:50.000000000 +0100
+++ Net-RabbitMQ-0.1.5.orig/RabbitMQ.xs 2010-04-22 01:06:16.000000000 +0100
@@ -413,7 +413,7 @@
amqp_boolean_t mandatory = 0;
amqp_boolean_t immediate = 0;
int rv;
- amqp_bytes_t exchange_b = {0};
+ amqp_bytes_t exchange_b;
amqp_bytes_t routing_key_b;
amqp_bytes_t body_b;
struct amqp_basic_properties_t_ properties;