12 Replies Latest reply on Dec 16, 2009 4:17 AM by ataylor

    java.lang.IndexOutOfBoundsException while testing with SPECj

      Hey,

      while testing the new HornetQ 2.0.0.CR1 release using SPECjms2007 we encountered the following error after a couple of messages were sent:

      [java] java.lang.IndexOutOfBoundsException
      [java] at org.jboss.netty.buffer.AbstractChannelBuffer.setIndex(AbstractChannelBuffer.java:66)
      [java] at org.hornetq.core.buffers.impl.ChannelBufferWrapper.setIndex(ChannelBufferWrapper.java:498)
      [java] at org.hornetq.core.message.impl.MessageImpl.encodeToBuffer(MessageImpl.java:843)
      [java] at org.hornetq.core.message.impl.MessageImpl.getEncodedBuffer(MessageImpl.java:438)
      [java] at org.hornetq.core.remoting.impl.wireformat.SessionSendMessage.encode(SessionSendMessage.java:75)
      [java] at org.hornetq.core.remoting.impl.ChannelImpl.send(ChannelImpl.java:153)
      [java] at org.hornetq.core.remoting.impl.ChannelImpl.send(ChannelImpl.java:143)
      [java] at org.hornetq.core.client.impl.ClientProducerImpl.doSend(ClientProducerImpl.java:263)
      [java] at org.hornetq.core.client.impl.ClientProducerImpl.send(ClientProducerImpl.java:141)
      [java] at org.hornetq.jms.client.HornetQMessageProducer.doSend(HornetQMessageProducer.java:444)
      [java] at org.hornetq.jms.client.HornetQMessageProducer.send(HornetQMessageProducer.java:210)
      [java] at org.spec.jms.agents.SPECWorkerThread.sendMessage(SPECWorkerThread.java:480)
      [java] at org.spec.jms.agents.SPECWorkerThread.sendInitialMessage(SPECWorkerThread.java:410)
      [java] at org.spec.jms.eventhandler.sm.SM_Interaction1DR.oneIteration(SM_Interaction1DR.java:107)
      [java] at org.spec.perfharness.WorkerThread.pace(WorkerThread.java:339)
      [java] at org.spec.jms.agents.SPECWorkerThread.pace(SPECWorkerThread.java:979)
      [java] at org.spec.jms.agents.SPECWorkerThread.run(SPECWorkerThread.java:750)
      [java] at org.spec.jms.eventhandler.sm.SM_Interaction1DR.run(SM_Interaction1DR.java:78)
      


      Any ideas whether it might be a configuration problem? The same tests worked using the beta5 version of HornetQ.

      Greets,
      Stefan

        • 1. Re: java.lang.IndexOutOfBoundsException while testing with S
          timfox

          If you can tell us how replicate this - i.e. what was spec jms doing to give this error, then someone can take a look.

          • 2. Re: java.lang.IndexOutOfBoundsException while testing with S

            Before the error occurred, SPECjms already audited the locations successfully and started sending messages. A base of 100 in vertical mode was used.
            Right before the error, everything looked fine:


            [java] SPAgent2: id=amsterdam_VM3,rate=4,57,threads=3
            [java] DCAgent1: id=amsterdam_VM4,rate=36,53,threads=7
            [java] DCAgent2: id=amsterdam_VM5,rate=39,93,threads=7
            [java]
            [java] HQAgent1: id=amsterdam_VM6,rate=80,83,threads=7
            [java] SMAgent3: id=amsterdam_VM0,rate=32,90,threads=9
            [java] HQAgent2: id=amsterdam_VM7,rate=86,47,threads=7
            [java] SPAgent3: id=amsterdam_VM2,rate=2,97,threads=3
            [java] SMAgent4: id=amsterdam_VM1,rate=30,67,threads=9
            [java]
            [java] SPAgent4: id=amsterdam_VM3,rate=4,60,threads=3
            [java] SMAgent5: id=amsterdam_VM0,rate=31,33,threads=9
            [java] SMAgent6: id=amsterdam_VM1,rate=34,63,threads=9
            [java] SPAgent5: id=amsterdam_VM2,rate=3,20,threads=3
            [java] SMAgent7: id=amsterdam_VM0,rate=33,00,threads=9
            [java] SMAgent8: id=amsterdam_VM1,rate=31,73,threads=9
            [java] SMAgent9: id=amsterdam_VM0,rate=31,40,threads=9
            [java] SMAgent10: id=amsterdam_VM1,rate=33,70,threads=9
            [java] SM_Interaction1DR_9_EHID_1: Uncaught exception.
            [java] java.lang.IndexOutOfBoundsException
            [java] at org.jboss.netty.buffer.AbstractChannelBuffer.setIndex(AbstractChannelBuffer.java:66)
            [java] at org.hornetq.core.buffers.impl.ChannelBufferWrapper.setIndex(ChannelBufferWrapper.java:498)
            [java] at org.hornetq.core.message.impl.MessageImpl.encodeToBuffer(MessageImpl.java:843)
            [java] at org.hornetq.core.message.impl.MessageImpl.getEncodedBuffer(MessageImpl.java:438)


            • 3. Re: java.lang.IndexOutOfBoundsException while testing with S
              timfox

              What we really need is a sequence of actions we can replicate so we can investigate further.

              • 4. Re: java.lang.IndexOutOfBoundsException while testing with S

                It should be easily possible to replicate this by using SPECjms. I can post or send you the according SPECjms configuration files, just let me know.

                • 5. Re: java.lang.IndexOutOfBoundsException while testing with S
                  ataylor

                  can you provide a pure JMS standalone test that we can use.

                  • 6. Re: java.lang.IndexOutOfBoundsException while testing with S
                    timfox

                    If you can give us some more info about what SpecJ is doing at the time you receive this exception it would help us in replicating it (since I don't have access to SpecJMS)

                    I assume SpecJ is sending a message.

                    Is it sending the same message on multiple threads concurrently, using different sessions?

                    Where did the message come from? Is it created right before send or was it received from a consumer?

                    What type of message is it? (TextMessage, BytesMessage, ObjectMessage etc)

                    Any more information you could provide would be helpful.

                    • 7. Re: java.lang.IndexOutOfBoundsException while testing with S

                       

                      I assume SPECjms is sending a message.

                      Yes

                      Is it sending the same message on multiple threads concurrently, using different sessions?

                      No, but multiple threads are sending in parallel using different sessions to the same queue.

                      A complete scenario description (incl. messages) is available in
                      http://www.dvs.tu-darmstadt.de/publications/pdf/PerfEvalJ-SPECjms2007.pdf
                      The exception occurs in the fist step in Interaction 1.

                      Where did the message come from? Is it created right before send or was it received from a consumer?

                      It is created right before sending. It is transactional / persistent.

                      What type of message is it? (TextMessage, BytesMessage, ObjectMessage etc)

                      ObjectMessage (avg. size: 2.34 kb, 95 %: 1.74 kb, 4 %: 7.10, 1%:41KB)


                      • 8. Re: java.lang.IndexOutOfBoundsException while testing with S
                        timfox

                         

                        "stefan_appel" wrote:
                        I assume SPECjms is sending a message.

                        Yes

                        Is it sending the same message on multiple threads concurrently, using different sessions?

                        No, but multiple threads are sending in parallel using different sessions to the same queue.


                        I'm confused by your answer here.

                        I asked if message was sent using different threads concurrently, and you said "No, but multiple threads are sending in parallel using different sessions to the same queue".

                        Isn't that the same thing?

                        Please clarify.

                        • 9. Re: java.lang.IndexOutOfBoundsException while testing with SPECj
                          johnnysoccer

                          I am encountering the same issue.  This is a copy of the information I added to jira HORNETQ-244

                           

                          Based on what I've tracked down, the error seems to be related to the data in the buffer being exactly the default size of the buffer.

                          In my scenario, when I finish creating the text message, the exact size of the buffer is 1500. At the point when I attempt to send the data, the org.hornetq.core.message.implMessageImpl.encodeToBuffer() method the following lines seem to cause the problem

                                   // write it
                                   buffer.setInt(PacketImpl.PACKET_HEADERS_SIZE, endOfBodyPosition);

                                   // Position at end of body and skip past the message end position int
                                   buffer.setIndex(0, endOfBodyPosition + DataConstants.SIZE_INT);

                          The endOfBodyPosition in my scenario = 1500
                          The call to buffer.setIndex() is now looking for an index of 1504, because of adding the DataConstants.SIZE_INT value, which, when it gets to the org.jboss.netty.buffer.AbstractChannelBuffer.setIndex() call, you fail the third condition in the "if" statement (writerIndex > capacity()) because the capacity is the the size of the buffer array (which was 1500).

                          All messages that I send where the buffer size is > 1500 work just fine.

                          • 10. Re: java.lang.IndexOutOfBoundsException while testing with SPECj
                            timfox
                            This is actually a bug in Netty, which I believe Trustin is looking at currently.
                            • 11. Re: java.lang.IndexOutOfBoundsException while testing with SPECj
                              johnnysoccer

                              Thanks for the response Tim.

                               

                              Is there a recommended work-around?

                              Do you know if the timeline for a fix in Netty will coincide with the GA release of HornetQ?

                              Can we use an older version of Netty since the bug seems to have presented itself in the CR1 release of HornetQ?

                               

                              -- John

                              • 12. Re: java.lang.IndexOutOfBoundsException while testing with SPECj
                                ataylor
                                There is currently a fix in Trunk. We will either ship GA with this fix or with a netty fix. either way GA will work fine.