-
Notifications
You must be signed in to change notification settings - Fork 305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Broker shutdown causes an unhandled exception in reader loop #138
Comments
Sorry, I do not understand what you are asking. How are you shutting down RabbitMQ? Are you sure you are not getting |
I had a |
Good to know. This has lead me to the following thought: should we always raise exceptions when connection is forcefully closed? Presumably reconnecting in that case is not what you typically want. |
Good point. I don't think there is a perfect automated solution. I see two common use cases:
I would suggest having a configurable parameter: the threshold after which you raise an exception after a forced connection close. |
require 'bunny'
begin
conn = Bunny.new(:heartbeat_interval => 8, :automatically_recover => false)
conn.start
ch = conn.create_channel
x = ch.default_exchange
q = ch.queue("mq", :durable => true)
q.purge
loop do
body = "0" * 1024
x.publish(body, :routing_key => "mq")
_, _, payload = q.pop
sleep 1
end
rescue Exception => e
puts e
sleep 1
retry
end on
|
@carlhoerberg what is your point? You are getting an exception because |
But I can't catch it?
|
It happens on a socket write attempt. Using single threaded or disabling automatic recovery will cause it to be raised on the connection thread. |
Actually, not exactly so: before |
When there is an option connection to the broker and the broker is shutdown, the following output is generated when the level is set to :debug. Why is the "handling" of the exception allowing it to leave the thread (and terminate an application where
Thread.abort_on_exception
is set to true)?The text was updated successfully, but these errors were encountered: