[rabbitmq-discuss] connection.close() hangs
Steve Haneman
shaneman at adobe.com
Thu Oct 14 22:45:32 BST 2010
A restart of the server cleared it up. No errors in the rabbitmq logs. Seems fishy. I had been running some load tests on the server prior to it acting this way.
--Steve
From: Steve Haneman
Sent: Thursday, October 14, 2010 2:13 PM
To: rabbitmq-discuss at lists.rabbitmq.com
Subject: connection.close() hangs
ubuntu-10.04.1-server-amd64
RabbitMQ 2.1.0, generic install
Java client: rabbitmq-java-client-bin-2.1.0
Java 1.5
The following code hangs on conn.close(). Specifying a timeout did not help. No issues when run on RabbitMQ 2.0.
--Steve
package com.bla.rabbit.test;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
import com.rabbitmq.client.MessageProperties;
public class Small {
/**
* @param args
*/
public static void main(String[] args) {
String exchange = "myexchangename";
String queue = "myqueuename";
String route = "myroutingkey";
String msg = "hello";
byte[] messageBodyBytes = msg.getBytes();
ConnectionFactory factory = new ConnectionFactory();
factory.setUsername("guest");
factory.setPassword("guest");
factory.setHost("127.0.0.1");
factory.setVirtualHost("test");
try {
Connection conn = factory.newConnection();
Channel pushChannel = conn.createChannel();
pushChannel.exchangeDeclare(exchange, "direct", true);
pushChannel.queueDeclare(queue, true, false, false, null);
pushChannel.queueBind(queue, exchange, route);
System.out.println("publish");
pushChannel.basicPublish(exchange, route, true, true, MessageProperties.PERSISTENT_TEXT_PLAIN, messageBodyBytes);
// we hang here
System.out.println("start close");
conn.close();
System.out.println("end close");
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20101014/6dea1b4a/attachment-0001.htm>
More information about the rabbitmq-discuss
mailing list