Kafka Error CONCURRENT_TRANSACTIONS
Error code 51 · Retriable Transactions
The producer attempted to update a transaction while another concurrent operation on the same transaction was ongoing.
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
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 APIs
This error can be returned by: AddOffsetsToTxn · AddPartitionsToTxn · EndTxn · InitProducerId
Debugging Kafka errors? Conduktor Console gives you real-time visibility into your cluster. Explore all errors in the Error Decoder.