Queue subscription exceptions kill workpool #186

Closed
bobbytables opened this Issue Jan 28, 2014 · 5 comments

Comments

Projects
None yet
2 participants
Contributor

bobbytables commented Jan 28, 2014

So when you have something like this:

queue.subscribe(ack: true) do |info, message, json|
  if rand > 0.5
    raise "Killed"
  else
    some_work
  end
end

When that raise happens, the subscription will never receive anything afterwards because the thread is dead in the water and Thread#abort_on_exception isn't turned on (from what I can tell).

I feel like subscribe should have a way to say how to handle errors or tack on something like on_exception for subscriptions.

I've combed issues / doc / code and I haven't seen anything so I'm wondering if this is something I'm doing also.

Cheers!

Owner

michaelklishin commented Jan 28, 2014

I can confirm that basic.deliver is dispatched without exception handling. basic.cancel is.

Java client has exception handlers and the default one simply dumps exceptions to stderr. We should do the same.

Contributor

bobbytables commented Jan 28, 2014

For now I just wrap my inner subscribe block with a begin / rescue and notify our exceptions service there.

Do you have a link to the java client handling or example? For us we'd love to have library support for exception handling as we use this library pretty extensively.

Owner

michaelklishin commented Jan 28, 2014

See javadoc. You define exception handler per connection. There is a default handler that dumps stack traces to stderr.

@michaelklishin michaelklishin pushed a commit that referenced this issue Jan 29, 2014

Michael Klishin Tests for #186 3e4bc25

@michaelklishin michaelklishin pushed a commit that referenced this issue Jan 29, 2014

Michael Klishin Tests for #186 f0f811a

@michaelklishin michaelklishin pushed a commit that referenced this issue Jan 29, 2014

Michael Klishin Delegate uncaught consumer exceptions to exception handler
This is what Java and C# clients do.

Fixes #186.
ef4ac93
Contributor

bobbytables commented Jan 29, 2014

Awesome, thanks for the quick response.

Owner

michaelklishin commented Jan 30, 2014

In 1.1.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment