GithubHelp home page GithubHelp logo

Error Frame received errors about stomp HOT 13 CLOSED

stompgem avatar stompgem commented on September 23, 2024
Error Frame received errors

from stomp.

Comments (13)

gmallard avatar gmallard commented on September 23, 2024

Lucas - We have not seen anything like that. 1.2.2 is known to be running without problems in some fairly large environments.

Do you have a small sample that reproduces this? If so, can you post it?

Question 1: you are using which of:

Stomp::Client
Stomp::Connection

Question 2: Do you have "\r" values embedded in header keys or values anywhere?

Question 3: If you are using a Stomp::Connection, do your 'subscribe' calls use the subscription ID (3rd parameter)?

I suggest you use the optional logging facility to get a better idea of what is happening. See the examples directory, files:

  • slogger.rb
  • logexamp.rb

Perhaps implement the:

on_subscribe
on_publish
on_receive

methods and dump any available data to a log. In 'on_subscribe' dump the headers. In 'on_publish' dump the entire message.

Unfortunately we do not have a logging callback for 'ack' at present.

If you have time, I would also like to know if the error occurs with 1.2.0 or 1.2.1 gems.

Those "\r" characters are ...... a bit disconcerting.

from stomp.

gmallard avatar gmallard commented on September 23, 2024

Those error messages are definitely from AMQ. See:

https://bitbucket.org/mirror/activemq/src/a35fdd13fb9b/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompWireFormat.java

Line number 207.

AMQ is not liking something about the headers. I need to see all headers put on to and received from the wire.

Question: what version of AMQ ?

Regarding "\r" characters embedded in headers;

a) This gem can send headers like that
b) This gem cannot receive headers like that (even in 1.1.10)
c) General info, "\r" is forbidden in STOMP 1.1

from stomp.

gmallard avatar gmallard commented on September 23, 2024

This message:

Unexpected ACK received for message-id 

is easily reproduced by sending ACKs to the broker out of sequence.

Possible?

from stomp.

2potatocakes avatar 2potatocakes commented on September 23, 2024

Hi guy, sorry thought you'd be asleep, I've been playing with it for a couple of hours.. Here's what I've found..

I'm using ActiveMQ 5.5.1 (When running AMQ on windows I cannot replicate this issue)
When using ActiveMQ on a CentOS box I do see this issue.

I'm currently using Ruby 1.8.7 and am sending and receiving from a windows machine.

Also this bug was reported to me through someone using my service_manager in the US, but I was able to replicate it here locally as well so it's not just my machine.

I cannot replicate the issue in stomp version 1.1.10, but I can replicate it using 1.2.0, 1.2.1 and 1.2.2

I'm absolutely certain that there are no "\r" characters in the headers as I also parse them in my own code and make sure they're removed.

It's a pain in the butt of a bug because it's not consistently replicable. It occurs occasionally which makes me think it maybe a mutex/thread issue?

from stomp.

2potatocakes avatar 2potatocakes commented on September 23, 2024

You were dead on the money with your AMQ bitbucket link as well. This is what I got when I added your slogger class to a test I was running.. .The java stack trace that came back in the body references the line you found:
org.apache.activemq.transport.stomp.StompWireFormat.unmarshal(StompWireFormat.java:109)

Also included my test files..

https://gist.github.com/2565253

from stomp.

gmallard avatar gmallard commented on September 23, 2024

Nice test files, they are excellent. I wish everyone would supply sample code like that.

I have confirmed:

  • I can almost totally recreate with Ruby 1.8.7
  • I get a variety of other similar failures for various Rubies 1.8.x, 1.9.x, and 2.0.0dev
  • Dropping back to gem 1.1.10 indeed appears to work - no exceptions - however I am not yet convinced that all is correct even at that level. Even there, queue display in the AMQ admin console do not look right.

I recreated totally on an Ubuntu box, 11.10. No need for me to even boot a Win VM for testing.

Line # 96 of receiver.rb - I do not know what 'StopServer' is, but it is not defined.

Yep, we are in wildly different time zones ...... I will play with this as the day progresses here.

from stomp.

gmallard avatar gmallard commented on September 23, 2024

There is a clue (I think) on line number 7 of the log file in your docs:

D, [2012-05-01T11:53:03.502290 #3624] DEBUG -- : Subscribe Headers destination/queue/font_requestackclient

That header display should show me a well formed Ruby Hash. I think I am looking at a single String.

Update:

This is a false lead. The example logger code does:

@log.debug "Subscribe Headers #{headers}"

When it should do:

@log.debug "Subscribe Headers #{headers.inspect}"

from stomp.

gmallard avatar gmallard commented on September 23, 2024

Lucas - Possible quick fix / get around - in your senders, do not do:

body = "\x00"

Instead do:

body = ""

Let me know if that clears up any or perhaps all of these issues.

I can and will get around this in the gem but changing your sender(s) might be easier if you are in a hurry. Let me know your thoughts.

If you want to apply a temp patch to the gem, then:

diff --git a/lib/stomp/connection.rb b/lib/stomp/connection.rb
index 84bde52..81beec8 100644
--- a/lib/stomp/connection.rb
+++ b/lib/stomp/connection.rb
@@ -611,7 +611,7 @@ module Stomp
         end
         @transmit_semaphore.synchronize do
           # Handle nil body
-          body = '' if body.nil?
+          body = '' if body.nil? || body == "\x00"
           # The content-length should be expressed in bytes.
           # Ruby 1.8: String#length => # of bytes; Ruby 1.9: String#length => #
           # With Unicode strings, # of bytes != # of characters.  So, use Strin

I truthfully think this result is an AMQ bug exposed by the current gem. Apollo in Stomp 1.0 mode handles your original example fine.

from stomp.

gmallard avatar gmallard commented on September 23, 2024

Notes about the above suggestion:

  • it may work in your particular case
  • use it with caution, because I do not believe the single byte body of "\x00" is the root cause
  • I can recreate this with a single byte body of "Z" or even "ZZTOP" and recreate this problem with your sample code

It seems to be related to the 'response' message ....... at this point.

I will keep looking at this as time permits.

from stomp.

gmallard avatar gmallard commented on September 23, 2024

OoooooK. I think I understand this. All of the above is Guy aiming clay mores at a problem. Ignore it.

Please do this:

  • Run a fresh install of 1.2.2
  • Apply the patch shown below
  • Retest everything and provide feedback

The patch:

diff --git a/lib/stomp/connection.rb b/lib/stomp/connection.rb
index adf59b2..804bbda 100644
--- a/lib/stomp/connection.rb
+++ b/lib/stomp/connection.rb
@@ -596,8 +596,8 @@ module Stomp
           # and ActiveMQ will interpret the message as a TextMessage.
           # For more information refer to http://juretta.com/log/2009/05/24/act
           # Lets send this header in the message, so it can maintain state when
-          headers['content-length'] = "#{body_length_bytes}" unless headers[:su
-          headers['content-type'] = "text/plain; charset=UTF-8" unless headers[
+          headers[:'content-length'] = "#{body_length_bytes}" unless headers[:s
+          headers[:'content-type'] = "text/plain; charset=UTF-8" unless headers
           used_socket.puts command
           headers.each do |k,v|
             if v.is_a?(Array)

from stomp.

2potatocakes avatar 2potatocakes commented on September 23, 2024

I just sat down at my desk.. Looks like you've been busy.. Thanks for your help on this. :)

I'll apply your patch now and give it a go. 2 mins.. just booting everything up

from stomp.

2potatocakes avatar 2potatocakes commented on September 23, 2024

Looks like that's done the trick mate, nice spot! I looked over that method yesterday and didn't notice the unsymbolized keys.. Am glad you spotted it. Have just ran it through a few dozen times and I can't see the issue anymore.

Massively appreciate your help on this! Hope it didn't take up too much of your time. If you ever need anything tested on Windows/CentOS/RedHat/AMQ feel free to drop me a line and I'll see if I can return the favour.
Kind Regards,
Lucas

from stomp.

gmallard avatar gmallard commented on September 23, 2024

Argh. Just realized that patch is truncated on the right. Thanks for figuring that out.

This will be included in 1.2.3. Keep the patch in the meantime.

Thanks for the offer on testing, will keep that in mind.

I am going to close this issue. Reopen it, or open another if necessary.

Regards, Guy

from stomp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.