tabalt opened a new issue #8084:
URL: https://github.com/apache/pulsar/issues/8084
**Describe the bug**
Bookkeeper triggered exception IndexOutOfBoundsException when consumer use
Key_Shared and producer enableBatching/set compressionType
```
17:05:50.237 [bookkeeper-ml-workers-OrderedExecutor-3-0] ERROR
org.apache.bookkeeper.common.util.SafeRunnable - Unexpected throwable caught
java.lang.IndexOutOfBoundsException: readerIndex: 89, writerIndex:
2023521513 (expected: 0 <= readerIndex <= writerIndex <= capacity(398))
at
io.netty.buffer.AbstractByteBuf.checkIndexBounds(AbstractByteBuf.java:112)
~[netty-buffer-4.1.48.Final.jar:4.1.48.Final]
at
io.netty.buffer.AbstractByteBuf.writerIndex(AbstractByteBuf.java:135)
~[netty-buffer-4.1.48.Final.jar:4.1.48.Final]
at
org.apache.pulsar.common.protocol.Commands.deSerializeSingleMessageInBatch(Commands.java:1707)
~[pulsar-common.jar:2.6.0]
at
org.apache.pulsar.broker.service.AbstractBaseDispatcher.peekStickyKey(AbstractBaseDispatcher.java:161)
~[pulsar-broker.jar:2.6.0]
at
org.apache.pulsar.broker.service.persistent.PersistentStickyKeyDispatcherMultipleConsumers.sendMessagesToConsumers(PersistentStickyKeyDispatcherMultipleConsumers.java:145)
~[pulsar-broker.jar:2.6.0]
at
org.apache.pulsar.broker.service.persistent.PersistentDispatcherMultipleConsumers.readEntriesComplete(PersistentDispatcherMultipleConsumers.java:476)
~[pulsar-broker.jar:2.6.0]
at
org.apache.bookkeeper.mledger.impl.OpReadEntry.lambda$checkReadCompletion$2(OpReadEntry.java:152)
~[managed-ledger.jar:2.6.0]
at
org.apache.bookkeeper.mledger.util.SafeRun$1.safeRun(SafeRun.java:32)
~[managed-ledger.jar:2.6.0]
at
org.apache.bookkeeper.common.util.SafeRunnable.run(SafeRunnable.java:36)
[bookkeeper-common-4.10.0.jar:4.10.0]
at
org.apache.bookkeeper.common.util.OrderedExecutor$TimedRunnable.run(OrderedExecutor.java:203)
[bookkeeper-common-4.10.0.jar:4.10.0]
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[?:1.8.0_151]
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[?:1.8.0_151]
at
io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
[netty-common-4.1.48.Final.jar:4.1.48.Final]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_151]
```
**To Reproduce**
```
Producer<byte[]> producer = client.newProducer()
.blockIfQueueFull(true)
.enableBatching(true)
.batchingMaxPublishDelay(50, TimeUnit.MILLISECONDS)
.batchingMaxMessages(1024)
.compressionType(CompressionType.ZLIB)
.messageRoutingMode(MessageRoutingMode.RoundRobinPartition)
.maxPendingMessages(1024)
.sendTimeout(0, TimeUnit.SECONDS)
.topic("xxxx")
.create();
Consumer consumer = client.newConsumer()
.topic("my-topic")
.subscriptionName("my-subscription")
.consumerName("my-consumer-name")
.subscriptionType(SubscriptionType.Key_Shared)
.subscriptionInitialPosition(SubscriptionInitialPosition.Earliest)
.messageListener(new PulsarMessageListener())
.receiverQueueSize(5000)
.ackTimeout(3000, TimeUnit.MILLISECONDS)
.maxTotalReceiverQueueSizeAcrossPartitions(50000)
.subscribe();
```
**Desktop (please complete the following information):**
- OS: MacOS
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]