{
  "id": "kafka/transaction-abortable",
  "signature": "org.apache.kafka.common.errors.TransactionAbortableException: The transaction has been aborted by the coordinator",
  "signature_zh": "org.apache.kafka.common.errors.TransactionAbortableException: 事务已被协调器中止",
  "regex": "TransactionAbortableException.*transaction has been aborted by the coordinator",
  "domain": "kafka",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "Transactional coordinator aborted the transaction due to a timeout, fencing, or coordinator failover.",
  "root_cause_type": "generic",
  "root_cause_zh": "事务协调器因超时、围栏或协调器故障转移而中止事务。",
  "versions": [
    {
      "version": "Kafka 3.4.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Kafka 3.5.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Kafka 3.6.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Increase transaction.timeout.ms to 3600000",
      "why_fails": "Longer timeout may mask underlying issues like coordinator instability or network partitions.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "Disable idempotent producer",
      "why_fails": "Transactions require idempotent producer; disabling it causes different errors.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Restart all brokers",
      "why_fails": "Restarting brokers does not clear the aborted transaction state; coordinator still has the abort marker.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Retry the transaction with a new transactional.id after aborting the current one.\nCode example:\nproducer.initTransactions();\ntry {\n  producer.beginTransaction();\n  // send messages\n  producer.commitTransaction();\n} catch (TransactionAbortableException e) {\n  producer.abortTransaction();\n  // Reinitialize with a new transactional.id\n  properties.put(\"transactional.id\", \"new-txn-id-\" + System.currentTimeMillis());\n  producer.close();\n  producer = new KafkaProducer<>(properties);\n  producer.initTransactions();\n}",
      "success_rate": 0.75,
      "how": "Retry the transaction with a new transactional.id after aborting the current one.\nCode example:\nproducer.initTransactions();\ntry {\n  producer.beginTransaction();\n  // send messages\n  producer.commitTransaction();\n} catch (TransactionAbortableException e) {\n  producer.abortTransaction();\n  // Reinitialize with a new transactional.id\n  properties.put(\"transactional.id\", \"new-txn-id-\" + System.currentTimeMillis());\n  producer.close();\n  producer = new KafkaProducer<>(properties);\n  producer.initTransactions();\n}",
      "condition": "",
      "sources": []
    },
    {
      "action": "Increase transaction coordinator timeout and ensure stable network.\nCommand to check coordinator:\nkafka-transactions --bootstrap-server localhost:9092 --describe --transactional-id my-txn-id\nSet in producer config:\nproperties.put(\"transaction.timeout.ms\", \"60000\");\nproperties.put(\"max.block.ms\", \"120000\");",
      "success_rate": 0.7,
      "how": "Increase transaction coordinator timeout and ensure stable network.\nCommand to check coordinator:\nkafka-transactions --bootstrap-server localhost:9092 --describe --transactional-id my-txn-id\nSet in producer config:\nproperties.put(\"transaction.timeout.ms\", \"60000\");\nproperties.put(\"max.block.ms\", \"120000\");",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Retry the transaction with a new transactional.id after aborting the current one.\nCode example:\nproducer.initTransactions();\ntry {\n  producer.beginTransaction();\n  // send messages\n  producer.commitTransaction();\n} catch (TransactionAbortableException e) {\n  producer.abortTransaction();\n  // Reinitialize with a new transactional.id\n  properties.put(\"transactional.id\", \"new-txn-id-\" + System.currentTimeMillis());\n  producer.close();\n  producer = new KafkaProducer<>(properties);\n  producer.initTransactions();\n}",
    "Increase transaction coordinator timeout and ensure stable network.\nCommand to check coordinator:\nkafka-transactions --bootstrap-server localhost:9092 --describe --transactional-id my-txn-id\nSet in producer config:\nproperties.put(\"transaction.timeout.ms\", \"60000\");\nproperties.put(\"max.block.ms\", \"120000\");"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://kafka.apache.org/documentation/#transactionalconfigs",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.82,
  "fix_success_rate": 0.75,
  "resolvable": "partial",
  "first_seen": "2024-01-10",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}