1 2 Previous Next 21 Replies Latest reply on Aug 21, 2011 10:03 AM by Yong Hao Gao

    STOMP and bug for persistent messages

    Massimo Paladin Newbie

      Hello,

       

      I am looking at HornetQ and STOMP component.

       

      I noticed a problem in case I send persistent messages through STOMP.

      I explain you the bad behavior.

      1. sending 1 message to a queue with persistent:true

      2. subscribing to that queue and receiving this message trigger an error in the Stomp client I have tried because the server sends out junk characters at the end of the frame.

       

      Instead, if I put persistent:false everything is fine.

      Something event more strange is that if I restart HornetQ between point 1 and 2 the server doesn't send junk after the frame.

       

      Could you have a look?

       

      Cheers,

      -Massimo

        • 1. Re: STOMP and bug for persistent messages
          Massimo Paladin Newbie

          This is tcpdump output, the first message is with persistent:false and the second is the one with persistent:true which crashes stomp clients:

          0x0000:  4500 0102 bad9 4000 3d06 e567 808e d030  E.....@.=..g...0

          0x0010:  808e cb67 1813 9209 b73e 37b6 f4f4 7dce  ...g.....>7...}.

          0x0020:  8018 002e 59fa 0000 0101 080a 1ee2 8dd8  ....Y...........

          0x0030:  b149 4785 4d45 5353 4147 450a 636f 6e74  .IG.MESSAGE.cont

          0x0040:  656e 742d 7479 7065 3a74 6578 742f 756e  ent-type:text/un

          0x0050:  6b6e 6f77 6e0a 7469 6d65 7374 616d 703a  known.timestamp:

          0x0060:  3133 3039 3933 3934 3231 3135 350a 7265  1309939421155.re

          0x0070:  6465 6c69 7665 7265 643a 6661 6c73 650a  delivered:false.

          0x0080:  6578 7069 7265 733a 300a 7375 6273 6372  expires:0.subscr

          0x0090:  6970 7469 6f6e 3a31 3136 6464 6361 302d  iption:116ddca0-

          0x00a0:  3465 3134 3136 6533 2d36 6131 392d 3239  4e1416e3-6a19-29

          0x00b0:  6336 2d32 0a70 7269 6f72 6974 793a 340a  c6-2.priority:4.

          0x00c0:  636f 6e74 656e 742d 6c65 6e67 7468 3a31  content-length:1

          0x00d0:  0a6d 6573 7361 6765 2d69 643a 3934 320a  .message-id:942.

          0x00e0:  6465 7374 696e 6174 696f 6e3a 6a6d 732e  destination:jms.

          0x00f0:  7175 6575 652e 6c6f 6164 712d 300a 0a37  queue.loadq-0..7

          0x0100:  000a                                     ..

           

           

          0x0000:  4500 0113 bada 4000 3d06 e555 808e d030  E.....@.=..U...0

          0x0010:  808e cb67 1813 9209 b73e 3884 f4f4 7dce  ...g.....>8...}.

          0x0020:  8018 002e a5db 0000 0101 080a 1ee3 07a0  ................

          0x0030:  b149 4787 4d45 5353 4147 450a 636f 6e74  .IG.MESSAGE.cont

          0x0040:  656e 742d 7479 7065 3a74 6578 742f 756e  ent-type:text/un

          0x0050:  6b6e 6f77 6e0a 7469 6d65 7374 616d 703a  known.timestamp:

          0x0060:  3133 3039 3933 3934 3538 3838 340a 7265  1309939458884.re

          0x0070:  6465 6c69 7665 7265 643a 6661 6c73 650a  delivered:false.

          0x0080:  6578 7069 7265 733a 300a 7375 6273 6372  expires:0.subscr

          0x0090:  6970 7469 6f6e 3a31 3136 6464 6361 302d  iption:116ddca0-

          0x00a0:  3465 3134 3136 6533 2d36 6131 392d 3239  4e1416e3-6a19-29

          0x00b0:  6336 2d32 0a70 7269 6f72 6974 793a 340a  c6-2.priority:4.

          0x00c0:  636f 6e74 656e 742d 6c65 6e67 7468 3a31  content-length:1

          0x00d0:  0a6d 6573 7361 6765 2d69 643a 3935 310a  .message-id:951.

          0x00e0:  6465 7374 696e 6174 696f 6e3a 6a6d 732e  destination:jms.

          0x00f0:  7175 6575 652e 6c6f 6164 712d 300a 0a36  queue.loadq-0..6

          0x0100:  0000 00be 0000 0000 0000 03b7 0100 0000  ................

          0x0110:  2200 0a                                  "..

           

          Cheers,

          -Massimo

          • 2. Re: STOMP and bug for persistent messages
            Massimo Paladin Newbie

            No one interested in giving a look?

            • 3. Re: STOMP and bug for persistent messages
              Andy Taylor Master

              have u tried the latest HornetQ version?

               

              what client are you using?

               

              a test mighthelp us with this

              • 5. Re: STOMP and bug for persistent messages
                Andy Taylor Master

                can you try with one of the main stomp clients and provide some instructions on how to recreate.

                • 6. Re: STOMP and bug for persistent messages
                  Massimo Paladin Newbie

                  I used http://search.cpan.org/~lcons/Net-STOMP-Client-1.1/ it is available in EPEL.

                   

                  Start tcpdump: tcpdump -nnvvXSs 0  tcp port 6163

                   

                  Code:

                  #! /usr/bin/perl

                  use Net::STOMP::Client;

                  $stomp = Net::STOMP::Client->new(uri => "stomp://migdev001:6163", version => "1.0");

                  $stomp->message_callback(sub {

                      my($self, $frame) = @_;

                      $count++;

                      return($self);

                  });

                  $stomp->connect(login => "guest", passcode => "guest", ack => "auto");

                  $stomp->send(destination => "jms.queue.test", body => "t1", persistent => "false");

                  $stomp->send(destination => "jms.queue.test", body => "t2", persistent => "false");

                  $stomp->send(destination => "jms.queue.test", body => "t3", persistent => "true");

                  $sid = $stomp->uuid();

                  $stomp->subscribe(ack => "auto", destination => "jms.queue.test", id => $sid, );

                  $count = 0;

                  while ($count < 10) {

                      $frame = $stomp->wait_for_frames(timeout => 1);

                      if ($frame) {

                          printf("received %s %d with id %s and body:\n%s\n",

                                 $frame->command(), $count, $frame->header("message-id"), $frame->body());

                      } else {

                        print("waiting for messages...\n");

                      }

                  }

                   

                  CODE output, script crash after parsing the 3rd message which is persistent:

                  received MESSAGE 1 with id 2205936107 and body:

                  t1

                  received MESSAGE 2 with id 2205936109 and body:

                  t2

                  received MESSAGE 3 with id 2205936111 and body:

                  t3

                  *** Net::STOMP::Client::Frame::_decode(): invalid or missing command

                   

                  TCPDUMP output

                   

                  First message received:


                  0x0000:  4500 00ed 6225 4000 3d06 3e31 808e d030  E...b%@.=.>1...0

                  0x0010:  808e cb67 1813 bd62 6bee fc8f aab6 6a6d  ...g...bk.....jm

                  0x0020:  8018 0036 1b8e 0000 0101 080a 43e8 9e79  ...6........C..y

                  0x0030:  ba8a b765 4d45 5353 4147 450a 7469 6d65  ...eMESSAGE.time

                  0x0040:  7374 616d 703a 3133 3130 3536 3035 3736  stamp:1310560576

                  0x0050:  3739 360a 7265 6465 6c69 7665 7265 643a  796.redelivered:

                  0x0060:  6661 6c73 650a 6578 7069 7265 733a 300a  false.expires:0.

                  0x0070:  7375 6273 6372 6970 7469 6f6e 3a31 6333  subscription:1c3

                  0x0080:  3632 6262 302d 3465 3164 3931 3430 2d31  62bb0-4e1d9140-1

                  0x0090:  6230 352d 3834 6339 2d31 0a70 7269 6f72  b05-84c9-1.prior

                  0x00a0:  6974 793a 340a 636f 6e74 656e 742d 6c65  ity:4.content-le

                  0x00b0:  6e67 7468 3a32 0a6d 6573 7361 6765 2d69  ngth:2.message-i

                  0x00c0:  643a 3232 3035 3933 3631 3037 0a64 6573  d:2205936107.des

                  0x00d0:  7469 6e61 7469 6f6e 3a6a 6d73 2e71 7565  tination:jms.que

                  0x00e0:  7565 2e74 6573 740a 0a74 3100 0a         ue.test..t1..

                   

                  Second message received:


                  0x0000:  4500 00ed 6226 4000 3d06 3e30 808e d030  E...b&@.=.>0...0

                  0x0010:  808e cb67 1813 bd62 6bee fd48 aab6 6a6d  ...g...bk..H..jm

                  0x0020:  8018 0036 1ad9 0000 0101 080a 43e8 9e79  ...6........C..y

                  0x0030:  ba8a b765 4d45 5353 4147 450a 7469 6d65  ...eMESSAGE.time

                  0x0040:  7374 616d 703a 3133 3130 3536 3035 3736  stamp:1310560576

                  0x0050:  3833 340a 7265 6465 6c69 7665 7265 643a  834.redelivered:

                  0x0060:  6661 6c73 650a 6578 7069 7265 733a 300a  false.expires:0.

                  0x0070:  7375 6273 6372 6970 7469 6f6e 3a31 6333  subscription:1c3

                  0x0080:  3632 6262 302d 3465 3164 3931 3430 2d31  62bb0-4e1d9140-1

                  0x0090:  6230 352d 3834 6339 2d31 0a70 7269 6f72  b05-84c9-1.prior

                  0x00a0:  6974 793a 340a 636f 6e74 656e 742d 6c65  ity:4.content-le

                  0x00b0:  6e67 7468 3a32 0a6d 6573 7361 6765 2d69  ngth:2.message-i

                  0x00c0:  643a 3232 3035 3933 3631 3039 0a64 6573  d:2205936109.des

                  0x00d0:  7469 6e61 7469 6f6e 3a6a 6d73 2e71 7565  tination:jms.que

                  0x00e0:  7565 2e74 6573 740a 0a74 3200 0a         ue.test..t2..

                   

                  Third message received:


                  0x0000:  4500 00fe 6227 4000 3d06 3e1e 808e d030  E...b'@.=.>....0

                  0x0010:  808e cb67 1813 bd62 6bee fe01 aab6 6a6d  ...g...bk.....jm

                  0x0020:  8018 0036 3582 0000 0101 080a 43e8 9e79  ...65.......C..y

                  0x0030:  ba8a b765 4d45 5353 4147 450a 7469 6d65  ...eMESSAGE.time

                  0x0040:  7374 616d 703a 3133 3130 3536 3035 3736  stamp:1310560576

                  0x0050:  3833 350a 7265 6465 6c69 7665 7265 643a  835.redelivered:

                  0x0060:  6661 6c73 650a 6578 7069 7265 733a 300a  false.expires:0.

                  0x0070:  7375 6273 6372 6970 7469 6f6e 3a31 6333  subscription:1c3

                  0x0080:  3632 6262 302d 3465 3164 3931 3430 2d31  62bb0-4e1d9140-1

                  0x0090:  6230 352d 3834 6339 2d31 0a70 7269 6f72  b05-84c9-1.prior

                  0x00a0:  6974 793a 340a 636f 6e74 656e 742d 6c65  ity:4.content-le

                  0x00b0:  6e67 7468 3a32 0a6d 6573 7361 6765 2d69  ngth:2.message-i

                  0x00c0:  643a 3232 3035 3933 3631 3131 0a64 6573  d:2205936111.des

                  0x00d0:  7469 6e61 7469 6f6e 3a6a 6d73 2e71 7565  tination:jms.que

                  0x00e0:  7565 2e74 6573 740a 0a74 3300 0000 8000  ue.test..t3.....

                  0x00f0:  0000 0083 7be9 ef01 0000 001c 000a       ....{.........

                   

                   

                   

                  Cheers,

                  -Massimo

                  • 7. Re: STOMP and bug for persistent messages
                    Andy Taylor Master

                    thats all a bit confusing, could you provide a simple test like i asked for, I dont really have the time at present to be setting up environments, also test one of themain stomp clients as this could be an issue with the client

                    • 8. Re: STOMP and bug for persistent messages
                      Massimo Paladin Newbie

                      I don't know if I will have the time to write a test.

                       

                      You can see the tcpdump output which is different for the third frame.

                       

                      http://search.cpan.org/~lcons/Net-STOMP-Client-1.1/ is one of the main: http://stomp.github.com/implementations.html

                      It is one of the best defined and also support Stomp 1.1

                       

                      I tried also with http://code.google.com/p/stomppy/ and I get the same.

                       

                      Cheers,

                      -Massimo

                      • 10. Re: STOMP and bug for persistent messages
                        Yong Hao Gao Master

                        Hi Massimo,

                         

                        I tried your script with 2.2.5.Final and I didn't get any error. Here is a sample output:

                         

                        howard@howard-ThinkPad-W510$ ./hq-stomp.pl

                        received MESSAGE 1 with id 27 and body:

                        t1

                        received MESSAGE 2 with id 29 and body:

                        t2

                        received MESSAGE 3 with id 31 and body:

                        t3

                        waiting for messages...

                        waiting for messages...

                        waiting for messages...

                        waiting for messages...

                        waiting for messages...

                        ^C

                        howard@howard-ThinkPad-W510$

                         

                        Howard

                        • 11. Re: STOMP and bug for persistent messages
                          Massimo Paladin Newbie

                          Hi Howard,

                           

                          did you use the same code as mine?

                           

                          Could you share configuration? Are you using libaio?

                           

                          Regards,

                          -Massimo

                          • 12. Re: STOMP and bug for persistent messages
                            Yong Hao Gao Master

                            Hi Massimo,

                             

                            I think I'm using NIO (I'll try AIO). I'm using the same perl code as you pasted here.

                            • 13. Re: STOMP and bug for persistent messages
                              Yong Hao Gao Master

                              my hornetq-configuration.xml

                               

                              <configuration xmlns="urn:hornetq"

                                             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                                             xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">

                               

                                 <paging-directory>${data.dir:../data}/paging</paging-directory>

                                

                                 <bindings-directory>${data.dir:../data}/bindings</bindings-directory>

                                

                                 <journal-directory>${data.dir:../data}/journal</journal-directory>

                                

                                 <journal-min-files>10</journal-min-files>

                                

                                 <large-messages-directory>${data.dir:../data}/large-messages</large-messages-directory>

                                

                                 <connectors>

                                    <connector name="netty">

                                       <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>

                                       <param key="host"  value="${hornetq.remoting.netty.host:localhost}"/>

                                       <param key="port"  value="${hornetq.remoting.netty.port:5445}"/>

                                    </connector>

                                   

                                    <connector name="netty-throughput">

                                       <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>

                                       <param key="host"  value="${hornetq.remoting.netty.host:localhost}"/>

                                       <param key="port"  value="${hornetq.remoting.netty.batch.port:5455}"/>

                                       <param key="batch-delay" value="50"/>

                                    </connector>

                                 </connectors>

                               

                                 <acceptors>

                                    <acceptor name="netty">

                                       <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>

                                       <param key="host"  value="${hornetq.remoting.netty.host:localhost}"/>

                                       <param key="port"  value="${hornetq.remoting.netty.port:5445}"/>

                                    </acceptor>

                                   

                                    <acceptor name="netty-throughput">

                                       <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>

                                       <param key="host"  value="${hornetq.remoting.netty.host:localhost}"/>

                                       <param key="port"  value="${hornetq.remoting.netty.batch.port:5455}"/>

                                       <param key="batch-delay" value="50"/>

                                       <param key="direct-deliver" value="false"/>

                                    </acceptor>

                               

                                    <acceptor name="stomp-acceptor">

                                       <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>

                                       <param key="protocol" value="stomp"/>

                                       <param key="port" value="61613"/>

                                    </acceptor>

                               

                                 </acceptors>

                               

                                 <security-settings>

                                    <security-setting match="#">

                                       <permission type="createNonDurableQueue" roles="guest"/>

                                       <permission type="deleteNonDurableQueue" roles="guest"/>

                                       <permission type="consume" roles="guest"/>

                                       <permission type="send" roles="guest"/>

                                    </security-setting>

                                 </security-settings>

                               

                                 <address-settings>

                                    <!--default for catch all-->

                                    <address-setting match="#">

                                       <dead-letter-address>jms.queue.DLQ</dead-letter-address>

                                       <expiry-address>jms.queue.ExpiryQueue</expiry-address>

                                       <redelivery-delay>0</redelivery-delay>

                                       <max-size-bytes>10485760</max-size-bytes>      

                                       <message-counter-history-day-limit>10</message-counter-history-day-limit>

                                       <address-full-policy>BLOCK</address-full-policy>

                                    </address-setting>

                                 </address-settings>

                               

                              </configuration>

                              • 14. Re: STOMP and bug for persistent messages
                                Yong Hao Gao Master

                                and my hornetq-jms.xml:

                                 

                                <configuration xmlns="urn:hornetq"

                                            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                                            xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd">

                                 

                                   <connection-factory name="NettyConnectionFactory">

                                      <xa>true</xa>

                                      <connectors>

                                         <connector-ref connector-name="netty"/>

                                      </connectors>

                                      <entries>

                                         <entry name="/XAConnectionFactory"/>

                                      </entries>

                                   </connection-factory>

                                  

                                   <connection-factory name="NettyConnectionFactory">

                                      <xa>false</xa>

                                      <connectors>

                                         <connector-ref connector-name="netty"/>

                                      </connectors>

                                      <entries>

                                         <entry name="/ConnectionFactory"/>

                                      </entries>

                                   </connection-factory>

                                  

                                   <connection-factory name="NettyThroughputConnectionFactory">

                                      <xa>true</xa>

                                      <connectors>

                                         <connector-ref connector-name="netty-throughput"/>

                                      </connectors>

                                      <entries>

                                         <entry name="/XAThroughputConnectionFactory"/>

                                      </entries>

                                   </connection-factory>

                                  

                                   <connection-factory name="NettyThroughputConnectionFactory">

                                      <xa>false</xa>

                                      <connectors>

                                         <connector-ref connector-name="netty-throughput"/>

                                      </connectors>

                                      <entries>

                                         <entry name="/ThroughputConnectionFactory"/>

                                      </entries>

                                   </connection-factory>

                                 

                                   <queue name="DLQ">

                                      <entry name="/queue/DLQ"/>

                                   </queue>

                                  

                                   <queue name="ExpiryQueue">

                                      <entry name="/queue/ExpiryQueue"/>

                                   </queue>

                                 

                                   <queue name="test">

                                      <entry name="/queue/test"/>

                                   </queue>

                                 

                                </configuration>

                                1 2 Previous Next