You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "Apurva Mehta (JIRA)" <ji...@apache.org> on 2017/10/05 05:23:00 UTC
[jira] [Created] (KAFKA-6015) NPE in RecordAccumulator
Apurva Mehta created KAFKA-6015:
-----------------------------------
Summary: NPE in RecordAccumulator
Key: KAFKA-6015
URL: https://issues.apache.org/jira/browse/KAFKA-6015
Project: Kafka
Issue Type: Bug
Affects Versions: 1.0.0
Reporter: Apurva Mehta
Assignee: Apurva Mehta
Priority: Blocker
Fix For: 1.0.0
I found this inadvertently while trying to create a system test to reproduce KAFKA-6003
{noformat}java.lang.NullPointerException
at org.apache.kafka.clients.producer.internals.RecordAccumulator.drain(RecordAccumulator.java:542)
at org.apache.kafka.clients.producer.internals.Sender.sendProducerData(Sender.java:270)
at org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:238)
at org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:163)
at java.lang.Thread.run(Thread.java:748)
{noformat}
The problem is with this line
{code:java}
if (first.hasSequence() && first.baseSequence() != transactionManager.nextBatchBySequence(first.topicPartition).baseSequence())
{code}
It is possible for the producer state to be reset (for instance if retries are expired), in which case the transaction manager will drop the in flight batches it is tracking. However, these batches will continue to be in the accumulator with a sequence, causing an NPE in the background thread on this line.
It would be better to drain the batches with the old Pid/Sequence in this case. Either they are accepted, or they will be returned to the user with an {{OutOfOrderSequenceException}} which is clearer.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)