Repository navigation
Closed
Description
Actual behavior
There is a condition in which the Java producer gets stuck sending truncated buffers. This can be seen happening in very precise conditions:
- Batching enabled (doesn't reproduce without batching at all)
- Network used ~100% in brokers/clients
- A decent number of partitions (eg: 300)
- Producer reconnecting (not necessarily creating TCP connection, but re-establishing the producer after a bundle unload).
Examples of exceptions :
In consumer logs:
2018-02-07 02:15:48,377 WARN org.apache.pulsar.client.impl.ClientCnx:159 [pulsar-client-io-1-1] [exceptionCaught] [/100.85.173.79:6650] Got exception IndexOutOfBoundsException : writerIndex: 1751739039 (expected: readerIndex(52) <= writerIndex <= capacity(20896))
java.lang.IndexOutOfBoundsException: writerIndex: 1751739039 (expected: readerIndex(52) <= writerIndex <= capacity(20896))
at org.apache.pulsar.shade.io.netty.buffer.AbstractByteBuf.writerIndex(AbstractByteBuf.java:118)
at org.apache.pulsar.shade.org.apache.pulsar.common.api.Commands.deSerializeSingleMessageInBatch(Commands.java:819)
at org.apache.pulsar.client.impl.ConsumerImpl.receiveIndividualMessagesFromBatch(ConsumerImpl.java:904)
at org.apache.pulsar.client.impl.ConsumerImpl.messageReceived(ConsumerImpl.java:812)
at org.apache.pulsar.client.impl.ClientCnx.handleMessage(ClientCnx.java:224)
at org.apache.pulsar.shade.org.apache.pulsar.common.api.PulsarDecoder.channelRead(PulsarDecoder.java:160)
In this case the consumer received a batch where the count of messages was 3, but there were actually only 2 messages in the frame.
In broker logs:
2018-02-08 04:53:44,176 - ERROR [pulsar-io-55-5:Producer@180] - [PersistentTopic{topic=persistent://matteo/local/ns2/t300-partition-270}] [local-1-5055] Failed to verify checksum
2018-02-08 04:53:44,176 - WARN [pulsar-io-55-5:ServerCnx@177] - [/10.0.0.218:35556] Got exception IndexOutOfBoundsException : readerIndex(0) + length(4) exceeds writerIndex(0): PooledSlicedByteBuf(
ridx: 0, widx: 0, cap: 0/0, unwrapped: PooledUnsafeDirectByteBuf(ridx: 128064, widx: 208394, cap: 262144))
java.lang.IndexOutOfBoundsException: readerIndex(0) + length(4) exceeds writerIndex(0): PooledSlicedByteBuf(ridx: 0, widx: 0, cap: 0/0, unwrapped: PooledUnsafeDirectByteBuf(ridx: 128064, widx: 20839
4, cap: 262144))
at io.netty.buffer.AbstractByteBuf.checkReadableBytes0(AbstractByteBuf.java:1403)
at io.netty.buffer.AbstractByteBuf.readInt(AbstractByteBuf.java:786)
at io.netty.buffer.AbstractByteBuf.readUnsignedInt(AbstractByteBuf.java:802)
at org.apache.pulsar.common.api.PulsarDecoder.channelRead(PulsarDecoder.java:75)
Possible causes
The tcpdump captures show that the "send" request from producer are truncated
Metadata
Metadata
Assignees
Labels
type/bugThe PR fixed a bug or issue reported a bug
Activity
merlimat commentedon Feb 9, 2018
Fixed in #1203