2 Replies Latest reply on Jan 19, 2011 2:30 PM by Clebert Suconic

    Failed to prepare message for receipt

    Paul Raisin Newbie

      We have a number of consumers reading large messages.

       

      Intermitently we get the following exception on a consumer and it prevents further messages from being consumed:

       

      SEVERE: Failed to prepare message for receipt

      > java.lang.IndexOutOfBoundsException

      >    at org.hornetq.core.client.impl.LargeMessageBufferImpl.popPacket(LargeMessageBufferImpl.java:1288)

      >    at org.hornetq.core.client.impl.LargeMessageBufferImpl.checkForPacket(LargeMessageBufferImpl.java:1342)

      >    at org.hornetq.core.client.impl.LargeMessageBufferImpl.getByte(LargeMessageBufferImpl.java:360)

      >    at org.hornetq.core.client.impl.LargeMessageBufferImpl.getBytes(LargeMessageBufferImpl.java:774)

      >    at org.hornetq.core.client.impl.LargeMessageBufferImpl.getBytes(LargeMessageBufferImpl.java:408)

      >    at org.hornetq.core.client.impl.LargeMessageBufferImpl.readBytes(LargeMessageBufferImpl.java:874)

      >    at org.hornetq.core.client.impl.LargeMessageBufferImpl.readBytes(LargeMessageBufferImpl.java:880)

      >    at org.hornetq.core.client.impl.LargeMessageBufferImpl.readSimpleString(LargeMessageBufferImpl.java:1116)

      >    at org.hornetq.core.client.impl.LargeMessageBufferImpl.readNullableSimpleString(LargeMessageBufferImpl.java:1089)

      >    at org.hornetq.jms.client.HornetQTextMessage.doBeforeReceive(HornetQTextMessage.java:143)

      >    at org.hornetq.jms.client.JMSMessageListenerWrapper.onMessage(JMSMessageListenerWrapper.java:68)

      >    at org.hornetq.core.client.impl.ClientConsumerImpl.callOnMessage(ClientConsumerImpl.java:822)

      >    at org.hornetq.core.client.impl.ClientConsumerImpl.access$100(ClientConsumerImpl.java:46)

      >    at org.hornetq.core.client.impl.ClientConsumerImpl$Runner.run(ClientConsumerImpl.java:940)

      >    at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:100)

      >    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)

      >    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

      >    at java.lang.Thread.run(Unknown Source){code}

       

      Looking at the  LargeMessageControllerImpl.java I suspect the most obvious cause is a timeout from:

       

           if (streamEnded)

               {

                  // no more packets, we are over the last one already

                  throw new IndexOutOfBoundsException();

               }

       

       

               int sizeToAdd = currentPacket != null ? currentPacket.getBody().length : 1;

               currentPacket = packets.poll(readTimeout, TimeUnit.SECONDS);

               if (currentPacket == null)

               {

                  throw new IndexOutOfBoundsException();

               }

       

       

               if (currentPacket.getBody() == null) // Empty packet as a signal to interruption

               {

                  currentPacket = null;

                  streamEnded = true;

                  throw new IndexOutOfBoundsException();

               }

       

      If this is the case then what setting can adjust the readTimeout variable? If not then what other conditions could possibly cause the interruption to consuming the largemessage?