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/06/01 22:27:04 UTC

[jira] [Created] (KAFKA-5364) Producer attempts to send transactional messages before adding partitions to transaction

Apurva Mehta created KAFKA-5364:
-----------------------------------

             Summary: Producer attempts to send transactional messages before adding partitions to transaction
                 Key: KAFKA-5364
                 URL: https://issues.apache.org/jira/browse/KAFKA-5364
             Project: Kafka
          Issue Type: Sub-task
    Affects Versions: 0.11.0.0
            Reporter: Apurva Mehta
            Assignee: Apurva Mehta
            Priority: Blocker
             Fix For: 0.11.0.0


Due to a race condition between the sender thread and the producer.send(), the following is possible: 

# In KakfaProducer.doSend(), we add partitions to the transaction and then do accumulator.append. 
# In Sender.run(), we check whether there are transactional request. If there are, we send them and wait for the response. 
# If there aren't we drain the accumulator queue and send the produce requests.
# The problem is that the sequence step 2, 1, 3 is entire possible. This means that we won't send the 'AddPartitions' request but yet try to send the produce data. Which results in a fatal error and requires the producer to close. 

The solution is that in the accumulator.drain, we should check again if there are pending add partitions requests, and if so, don't drain anything.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)