I recreated this exception with a very simple test-case. I took the consumer code pasted earlier in the thread and just added a producer sending a large message. I lowered the minLargeMessageSize to make it faster. I thought I still had that code laying around somewhere, but I can't find it at the moment.
Justin On Sun, Feb 20, 2022 at 9:03 AM Clebert Suconic <clebert.suco...@gmail.com> wrote: > I have seen (and fixed) cases where the large message file is gone. I > would need a reproducer creating the issue from scratch (send and consume) > > Typically it could be associated with paging ? Did you have the > destination in page mode ? > > On Thu, Feb 17, 2022 at 6:53 PM Tim Jones <t...@abcwxy.com> wrote: > > > The client code below the stack trace - will reproduce it - the > > msg.getDataBuffer() inside the handler of that code will trigger it when > a > > large message is sent to the address. The exception in question > > (IndexOutOfBoundsException) is being caught in line 249 of the apache > > CoreMessage code... and turned into a logged warning on line 250. The > > CoreMessage code then returns the buffer from getReadOnlyBuffer() (which > > appears to be fine from a quick survey - data also seems to be preserved > > and accessible from client code) - it is just not clear what the intent > is > > if the exception code is executed... is it a "don't worry about it" - or > a > > "something is wrong here" and I should concern myself with something? > (the > > warning level is making me believe that it is more than a "don't worry > > about it" - but the fact that the exception was caught and a valid buffer > > is returned makes me think it is just a fallback for the other choices of > > buffers - and I should not worry about it?). > > > > Thanks for any insight you may have.... > > > > logged warning from the caught exception is: > > > > 16:26:50.923 [Thread-0 (ActiveMQ-client-global-threads)] WARN > > org.apache.activemq.artemis.core.message.impl.CoreMessage - > readerIndex(4) > > + length(270740) exceeds writerIndex(4): > > UnpooledByteBufAllocator$InstrumentedUnpooledUnsafeHeapByteBuf(ridx: 4, > > widx: 4, cap: 270740) > > java.lang.IndexOutOfBoundsException: readerIndex(4) + length(270740) > > exceeds writerIndex(4): > > UnpooledByteBufAllocator$InstrumentedUnpooledUnsafeHeapByteBuf(ridx: 4, > > widx: 4, cap: 270740) > > at > > > > > io.netty.buffer.AbstractByteBuf.checkReadableBytes0(AbstractByteBuf.java:1442) > > at > > > > > io.netty.buffer.AbstractByteBuf.checkReadableBytes(AbstractByteBuf.java:1428) > > at io.netty.buffer.AbstractByteBuf.readBytes(AbstractByteBuf.java:937) > > at > > > > > org.apache.activemq.artemis.core.client.impl.ClientMessageImpl$DecodingContext.readInto(ClientMessageImpl.java:407) > > at > > > > > org.apache.activemq.artemis.core.message.impl.CoreMessage.getLargeMessageBuffer(CoreMessage.java:264) > > at > > > > > org.apache.activemq.artemis.core.message.impl.CoreMessage.getDataBuffer(CoreMessage.java:241) > > at io.m45.sart.Main.lambda$main$0(Main.java:57) > > at > > > > > org.apache.activemq.artemis.core.client.impl.ClientConsumerImpl.callOnMessage(ClientConsumerImpl.java:1013) > > at > > > > > org.apache.activemq.artemis.core.client.impl.ClientConsumerImpl$Runner.run(ClientConsumerImpl.java:1133) > > at > > > > > org.apache.activemq.artemis.utils.actors.OrderedExecutor.doTask(OrderedExecutor.java:42) > > at > > > > > org.apache.activemq.artemis.utils.actors.OrderedExecutor.doTask(OrderedExecutor.java:31) > > at > > > > > org.apache.activemq.artemis.utils.actors.ProcessorBase.executePendingTasks(ProcessorBase.java:65) > > at > > > > > java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) > > at > > > > > java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) > > at > > > > > org.apache.activemq.artemis.utils.ActiveMQThreadFactory$1.run(ActiveMQThreadFactory.java:118) > > 16:26:50.924 [Thread-0 (ActiveMQ-client-netty-threads)] DEBUG > > org.apache.activemq.artemis.core.client.impl.ClientConsumerImpl - Sending > > 65962 from flow-control > > > > Simple Client Code below: > > > > > > public class Main { > > > > private final static String ACCEPTOR = "tcp://localhost:9322"; > > private final static String QUEUE="service.images.dev:: > > service.images.dev"; > > > > public static void main(String[] args) throws Exception { > > > > final String username = null; > > final String password = null; > > > > var serverLocator = ActiveMQClient > > .createServerLocator(ACCEPTOR) > > .setBlockOnDurableSend(true) > > .setBlockOnNonDurableSend(true); > > > > final var sessionFactory = serverLocator.createSessionFactory(); > > > > final var xa = false; > > final var autoCommitSends = true; > > final var autoCommitAcks = true; > > final var ackBatchSize = serverLocator.getAckBatchSize(); > > final var preAcknowledge = serverLocator.isPreAcknowledge(); > > final var clientSession = sessionFactory.createSession( > > username, > > password, > > xa, > > autoCommitSends, > > autoCommitAcks, > > preAcknowledge, > > ackBatchSize > > ); > > > > var queueQueryResult = > > clientSession.queueQuery(SimpleString.toSimpleString(QUEUE)); > > if (!queueQueryResult.isExists()) { > > clientSession.createQueue(_ServiceQueueConfiguration(new > > SimpleString(QUEUE))); > > } > > > > final var consumer = clientSession.createConsumer(QUEUE); > > > > clientSession.start(); > > > > consumer.setMessageHandler((msg) -> { > > > > System.out.println("Received: "+msg.getBodySize()); > > msg.getDataBuffer(); > > > > }); > > > > while(true) { > > Thread.sleep(1000); > > } > > > > } > > > > private static QueueConfiguration > > _ServiceQueueConfiguration(SimpleString queueName) { > > final var config = new QueueConfiguration(queueName); > > config.setMaxConsumers(1); > > config.setPurgeOnNoConsumers(false); > > config.setDurable(false); > > config.setAutoDelete(false); > > config.setRoutingType(RoutingType.MULTICAST); > > return config; > > } > > > > > > On Thu, Feb 17, 2022 at 2:28 PM Justin Bertram <jbert...@apache.org> > > wrote: > > > > > Typically an IndexOutOfBoundsException indicates a bug. Do you have a > way > > > to reproduce this? > > > > > > > > > Justin > > > > > > On Thu, Feb 17, 2022 at 3:17 PM Tim Jones <t...@abcwxy.com> wrote: > > > > > > > This seems to appear on larger messages only - I am getting a warning > > > when > > > > calling getDataBuffer (2.20.0 Artemis Client). Curious if there is > > > > something I may be missing - or if this is completely ignorable? > > Thanks - > > > > Tim > > > > > > > > 2022-02-17T21:06:11,908+01:00 [Thread-2 > > (ActiveMQ-client-global-threads)] > > > > WARN o.a.a.a.c.m.i.CoreMessage [Thread-2 > > > (ActiveMQ-client-global-threads)] > > > > readerIndex(270740) + length(270740) exceeds writerIndex(271572): > > > > UnpooledByteBufAllocator$InstrumentedUnpooledUnsafeHeapByteBuf(ridx: > > > > 270740, widx: 271572, cap: 271572) > > > > java.lang.IndexOutOfBoundsException: readerIndex(270740) + > > length(270740) > > > > exceeds writerIndex(271572): > > > > UnpooledByteBufAllocator$InstrumentedUnpooledUnsafeHeapByteBuf(ridx: > > > > 270740, widx: 271572, cap: 271572) > > > > at > > > > > > > > > > > > > > io.netty.buffer.AbstractByteBuf.checkReadableBytes0(AbstractByteBuf.java:1442) > > > > at > > > > > > > > > > > > > > io.netty.buffer.AbstractByteBuf.checkReadableBytes(AbstractByteBuf.java:1428) > > > > at > io.netty.buffer.AbstractByteBuf.readBytes(AbstractByteBuf.java:937) > > > > at > > > > > > > > > > > > > > org.apache.activemq.artemis.core.client.impl.ClientMessageImpl$DecodingContext.readInto(ClientMessageImpl.java:407) > > > > at > > > > > > > > > > > > > > org.apache.activemq.artemis.core.message.impl.CoreMessage.getLargeMessageBuffer(CoreMessage.java:264) > > > > at > > > > > > > > > > > > > > org.apache.activemq.artemis.core.message.impl.CoreMessage.getDataBuffer(CoreMessage.java:241) > > > > > > > > > > -- > Clebert Suconic >