[rabbitmq-discuss] Consumer connection closes abruptly after one message

p2w tpletch001 at gmail.com
Wed Nov 16 17:11:36 GMT 2011


Thanks for the heads up on all accounts. I added the following to my
initializer per the documentation:
connection.on_tcp_connection_loss do |connection, settings|
     puts "recovering RabbitMQ TCP Connection"
     connection.reconnect(false, 10)

What's interesting is that if there is absolutely no activity in the
app through the application interface itself, then this exception code
reconnects the consumer consistently after the TCP exception
disconnects the client. However as soon as any activity occurs in the
app interface the reconnect fails. This makes me pretty sure this is
an issue with Thin/EM blocking AMQP at thread level. I can replicate
this consistently.

I'm going to make sure I am up to date on the EM and AMQP gems, then
try the AMQP::Integration::Rails...

On Nov 16, 9:52 am, Michael Klishin <michael.s.klis... at gmail.com>
> 2011/11/16 p2w <tpletch... at gmail.com>
> > I'm sure I'm doing something wrong in the initializer but can't figure
> > out what as its really pretty vanilla. Any help greatly appreciated...
> I apologize for not noticing that you are using Thin. One thing that may
> cause abrupt TCP connection termination is uncaught exception on the
> EventMachine
> thread (in this case, your applications' main thread). In some cases it may
> be swallowed by
> various "helpful" libraries. Can you try removing more and more
> code from your consumer handlers to see at what point connection becomes
> stable?
> Also, with at least a couple of most recent point amqp gem releases you can
> simplify your initializer
> a little bit by renaming config file to amqp.yml and using
> AMQP::Integration::Rails:
> https://gist.github.com/3d995824090df94558b0
> Sorry that it is undocumented yet.
> --
> MK
> http://github.com/michaelklishinhttp://twitter.com/michaelklishin
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-disc... at lists.rabbitmq.comhttps://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

More information about the rabbitmq-discuss mailing list