Closed ripienaar closed 12 years ago
Thanks. This recreates on my development machine. Will do some more investigation over the weekend.
The code looks a bit strange because there is no subscribe, but that has no bearing on the issue described.
Indeed, usually would have a subscribe this was the simplest code to demonstrate the problem
I just took this code from my stomp irb (ripienaar/stomp-irb) which starts off without a subscription but it makes no diff either way.
thanks!
The cause is something that was anticipated during 1.1 development, and was ...... apparently only partially coded for in the heartbeat receive thread. Clearly we missed something. I believe what is happening is that in the '_receive' method, this line:
line = read_socket.gets
is consuming heartbeat data (a '\n') and not handling it correctly. That line normally consumes an entire command, such as 'CONNECTED\n" or 'MESSAGE\n'.
When I have a fix that works I'll report here.
I can get you a gem to smoke test if you would like. Let me know if you want to test that way ....
.... Or in connection.rb, you can replace line #519, this line:
line = read_socket.gets
with this code:
line = ''
if @protocol == Stomp::SPL_10 || (@protocol >= Stomp::SPL_11 && !@hbr)
line = read_socket.gets # The old way
else # We are >= 1.1 and receiving heartbeats.
while true
line = read_socket.gets # Data from wire
break unless line == "\n"
line = ''
@lr = Time.now.to_f
end
end
Let me know.
Very sweet. The first real 1.1 bug.
either is fine, I can test this fix in a hour or two :)
Go ahead and put the patch in please.
I'll cut and release a new gem when you feel you are complete with your 1.1 testing.
But lets see if anything else is uncovered in that process.
Patch applied and it works - I have a bunch of other 1.1 fixes to do before I can use this in my larger projects
The stomp-irb in my github account has now been updated to include 1.1 and from doing a bunch of sending/receiving/subscribing etc this patch seems to do it for me
Fix is in 4375706 and will be in the next release.
thank you :)
hello,
Given the code
So there's a background thread that just loops and receives and prints what it gets while the rest of the program continues. I am not sure if this is the intended use pattern for achiving this but it does work in 1.0 mode quite well and I've used this style of code all over.
When 1.1 protocol heartbeats are enabled this happens after some time: