Kafka Exception ConcurrentTransactionsException
org.apache.kafka.common.errors.ConcurrentTransactionsException
Retriable
Transactions
ConcurrentTransactionsException is a Kafka exception (org.apache.kafka.common.errors.ConcurrentTransactionsException).
Common Causes
- Two concurrent requests for the same transactional.id reached the coordinator simultaneously (e.g., client retrying InitProducerId while one is still in-flight)
- AddPartitionsToTxn and EndTransaction requests sent concurrently for the same transaction before the first completes
- High-latency coordinator response caused the client to retry a transactional request that was still being processed server-side
Solutions
- This is retriable — the client should back off and retry; ensure retry.backoff.ms and retries are set to reasonable values
- Increase request.timeout.ms on the producer to reduce spurious retries under high coordinator load
- Serialize transactional control calls such as beginTransaction(), sendOffsetsToTransaction(), commitTransaction(), and abortTransaction() for a given transactional.id; KafkaProducer send() is thread-safe, but overlapping transaction-control operations cause coordinator conflicts
Example Stack Trace
org.apache.kafka.common.errors.ConcurrentTransactionsException: The producer attempted to update a transaction while another concurrent operation on the same transaction was ongoing.Diagnostic Commands
# Look for transaction events in logs
grep 'CONCURRENT_TRANSACTIONS\|ConcurrentTransactions' /var/log/kafka/server.log | tail -20
# Inspect __transaction_state topic health
kafka-topics.sh --bootstrap-server localhost:9092 --describe --topic __transaction_state 2>&1 | grep -E 'Leader|Isr|UnderReplicated'Related
Protocol error: CONCURRENT_TRANSACTIONS (code 51)
Related Transactions exceptions: InvalidTxnStateException · ProducerFencedException
Hitting
ConcurrentTransactionsException in production? Conduktor Console gives you real-time visibility into clients, consumer groups, and broker health. Browse every Kafka exception or protocol error code.