[rabbitmq-discuss] Unexpected server crash and .NET API: disconnect is not detected?

Alfonso alfonso.pantoja at gmail.com
Thu Mar 31 10:49:32 BST 2011


One more thing regarding my previous message:

1. I disabled the newtwork connection from my development machine
(RabbitMQ server is on another machine).

2. I've see that the connection is still in some way "alive" even if I
kill the application because it appears on RabbitMQ web admin as
"running" but not sure if its a problem with my implementation or  it
is a issue regarding QueueingBasicConsumer.
Maybe this is happening due to foreach keep looping so my code keeps
trying to process messages and sending acks or rejects to the server
which always fail because there is no connection.

Regards,


Alfonso


On 31 mar, 11:38, Alfonso Pantoja <alfonso.pant... at gmail.com> wrote:
> Hi Emile,
>
> I'm using a class based on Subscription (the core functionality is the same
> as Subscription in v2.2.0 and the only differences are that I have new
> methods and made public a pair of private properties) called from a
> RpcServer class (which I also made my own modifications but calls my custom
> Subscription class the same way as the v2.2.0 provided classes)
>
> I can reproduce the issue (but I'm not sure if it is a expected behavior) by
> doing the following steps:
>
> 1. Send  messages to a queue
> 2. Start a consumer application
> 3. Disable the network connection in order to simulate an unexpected crash.
>
> What I see is that the my custom RpcServer class which recover  the messages
> keep looping with the foreach although there connection is closed.
>
> public void MainLoop()
> {
>
>             foreach (BasicDeliverEventArgs evt in m_subscription)
>             {
>                     ProcessRequest(evt);
>             }
>
>  }
>
> In my custom Subscription class I see that the method Next is returning all
> events even if the consumer is not running and no exception is launched when
> is called by foreach loop.
> (note: Next() is identical to Subscription class in v2.2.0 because I didn't
> modiy it)
>
>         public BasicDeliverEventArgs Next()
>         {
>             try
>             {
>                 QueueingBasicConsumer consumer = m_consumer;
>                 if (consumer == null)
>                 {
>                     // Closed!
>                     m_latestEvent = null;
>                 }
>                 else
>                 {
>
>                     m_latestEvent =
> (BasicDeliverEventArgs)consumer.Queue.Dequeue();
>                 }
>             }
>             catch (EndOfStreamException)
>             {
>                 m_latestEvent = null;
>             }
>             return m_latestEvent;
>         }
>
> My question is: should consumer.Queue.Dequeue() raise an exception when
> "consumer" property IsRunning is false?
> Currently this is not happening.
>
> In my code a workaround could be to check consumer.IsRunning and assign
> m_lastestEvent to null when if it is "false" and in MainLoop handle that or
> to launch an excepcion which would cause MainLoop to end.
>
> Any advice would be appreaciated.
>
> Thank you in advance.
>
> Regards,
>
> Alfonso
>
> 2011/3/30 Emile Joubert <em... at rabbitmq.com>
>
>
>
>
>


More information about the rabbitmq-discuss mailing list