stompgem / stomp

A ruby gem for sending and receiving messages from a Stomp protocol compliant message queue. Includes: failover logic, ssl support.
http://stomp.github.com
Apache License 2.0
152 stars 80 forks source link

Fix infinite loop when max_reconnect_attempts is reached. #62

Closed ismith closed 11 years ago

ismith commented 11 years ago

Fix for: https://github.com/stompgem/stomp/issues/61

gmallard commented 11 years ago

Hi Ian - Thanks for the pull request. However, please post a short example program showing when the infinite loop occurs and it should not.

In particular I need to know what the value of:

:max_reconnect_attempts => ??

In your example program.

The default for that value is 0. The semantics of that is retry forever....... Clients must override that to control (lower) the maximum number of retries.

In the absence of a convincing example, I am inclined to not merge this.

Thanks and Regards, Guy

rtyler commented 11 years ago

In our case (@ismith and I are colleagues) we have set :max_reconnect_attempts => 3 in our Stomp::Client configuration

gmallard commented 11 years ago

Well, I will ponder how to recreate this.

Please show me your:

cli = Stomp::Client.new(.....)
ismith commented 11 years ago

https://gist.github.com/ismith/6109518

The above recreates it; kill activemq after the first message-published output, and it will try to reconnect N>2 times. (Eventually failing on Stomp::Error::NoCurrentConnection)

ismith commented 11 years ago

Whereas, running the same test using the pull request above should only try to reconnect twice, then give up. (It will still eventually fail on NoCurrentConnection, that's expected behavior.)

gmallard commented 11 years ago

Thanks. So .... give me more pull requests.

Work on 'dev' please.

ismith commented 11 years ago

So .... give me more pull requests.

@gmallard This pull request should resolve the issue in question; was there other behavior you feel is related to this issue? (If not, can you bump the version and release to rubygems?)

gmallard commented 11 years ago

Ian - As far as a version bump, I am going to work on one other issue before I do that. In the mean time I suggest you build locally from the current master's HEAD.

gmallard commented 11 years ago

Version bump done, on rubygems.