Closed ripienaar closed 11 years ago
I believe what you have uncovered is ..... not the bug you think you have uncovered. Please read on.
There is a bug that is triggered even before the reconnect attempts occur.
In this case:
That is a protocol error on your part.
What should happen is this:
The gem handles this correctly if :reliable => false. This bug is with :reliable => true being specified.
I agree that reconnect delays etc. should be honored during the first connect attempt. And in fact they normally are. Try this with your example:
Re-run that example. You should see the times increase appropriately. Back offs are good e.g.:
time ruby -I $STOMPLIB reconnopen.rb
1368206597.0774972: failed to connect: localhost
1368206597.1783278: failed to connect: localhost
1368206597.379195: failed to connect: localhost
1368206597.780118: failed to connect: localhost
1368206598.580965: failed to connect: localhost
1368206600.1819065: failed to connect: localhost
1368206603.3828065: failed to connect: localhost
1368206609.783764: failed to connect: localhost
1368206622.5846832: failed to connect: localhost
1368206648.1856654: failed to connect: localhost
1368206678.186619: failed to connect: localhost
/ad3/gma/stomp-repos/stompgem/lib/connection/utils.rb:142:in `rescue in block in socket': Maximum number of
reconnection attempts reached (Stomp::Error::MaxReconnectAttempts)
...
...
real 1m21.166s
user 0m0.040s
sys 0m0.024s
Ignore the line number difference in utils.rb between my example and yours.
Your thoughts?
Yeah, I know it works sometimes - certainly does when I give it full correct properties etc - I assumed there were some code paths that didn't maintain the needed counters but your explanation sounds better.
So I guess this is a case of a bug related to failing better on config error and perhaps with some better messages
See e9d59a2
This will be in the next gem release.
If I make a deliberate mistake here - not specifying :"accept-version" header - the reconnect delays and backoffs arent honoured:
you can see there is no backoff of anything here
so the settings are for reconnections, but I think this should also apply in the initial connetion setup?