[rabbitmq-discuss] subscriber failed to detect closed connection

Mark Ward ward.mark at gmail.com
Thu Aug 2 15:58:51 BST 2012


I am performing tests to a server across the internet.  During the night 
our firewall is rebooted and it appears the basic consumer is not detecting 
this and does not throw any exceptions on the connection.  When I arrive to 
the office each morning the subscriber client is still running and in the 
block state waiting for a message.  If I send messages to the server the 
client will not receive messages unless I restart the client.  The client 
works all day long as I push millions of messages through for testing.  It 
is after the firewall reset that the client does not continue to work or 
fail out.  This does appear to be a repeatable issue for the past two days 
it has performed this same issue.  I am going to continue tonight to see if 
it repeats.

Is there something I need to enable to have the client detect the 
connection closure?  The testing I have manually performed on closing the 
network connection, shutting down the server, restarting the server have 
all caused the client to properly throw and exception that the connection 
was closed.  It is only when the firewall resets that the client does not 
detect the failed connection. 

This is the .NET client connecting to the port 5672.  It is not using SSL.

below is the example code I am working with.

var connectionFactory = new ConnectionFactory();
            connectionFactory.HostName = hostName;
            connectionFactory.Port = port;

            IConnection connection = connectionFactory.CreateConnection();
            IModel channel = connection.CreateModel();

            QueueingBasicConsumer consumer = new 
            String consumer_tag = channel.BasicConsume("QueueOne", false, 

            Console.WriteLine("ctrl+c to exit");
            while (true)
                BasicDeliverEventArgs evt_args = 
                IBasicProperties msg_props = evt_args.BasicProperties;
                string message = Encoding.UTF8.GetString(evt_args.Body);

                channel.BasicAck(evt_args.DeliveryTag, false);

                Console.WriteLine("Message Body: " + message);

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20120802/63cb4afa/attachment.htm>

More information about the rabbitmq-discuss mailing list