{
  "id": "kafka/group-rebalance-timeout",
  "signature": "org.apache.kafka.common.errors.RebalanceInProgressException: The group is rebalancing, so a rebalance is already in progress.",
  "signature_zh": "org.apache.kafka.common.errors.RebalanceInProgressException: 组正在重新平衡，因此重新平衡已在进行中。",
  "regex": "org\\.apache\\.kafka\\.common\\.errors\\.RebalanceInProgressException: The group is rebalancing, so a rebalance is already in progress\\.",
  "domain": "kafka",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A consumer request (like offset commit or join group) was made while a consumer group rebalance was already in progress, causing the request to be rejected.",
  "root_cause_type": "generic",
  "root_cause_zh": "在消费者组重新平衡正在进行时，消费者请求（如偏移提交或加入组）被发出，导致请求被拒绝。",
  "versions": [
    {
      "version": "Kafka 2.8.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Kafka 3.0.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Kafka 3.4.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 the session.timeout.ms to a very high value",
      "why_fails": "Session timeout controls heartbeat detection, not rebalance duration; a high value may delay failure detection but does not prevent rebalance conflicts.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "Set the consumer to use static group membership",
      "why_fails": "Static membership reduces rebalance frequency but does not eliminate it; rebalance can still be triggered by coordinator changes or partition reassignments.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Increase max.poll.interval.ms to allow more time for processing between polls, reducing the chance of rebalance being triggered:\n\nProperties props = new Properties();\nprops.put(\"max.poll.interval.ms\", 600000);  // 10 minutes\nprops.put(\"max.poll.records\", 500);  // Fewer records per poll\n\nAnd ensure the consumer processes records quickly or uses async processing.",
      "success_rate": 0.8,
      "how": "Increase max.poll.interval.ms to allow more time for processing between polls, reducing the chance of rebalance being triggered:\n\nProperties props = new Properties();\nprops.put(\"max.poll.interval.ms\", 600000);  // 10 minutes\nprops.put(\"max.poll.records\", 500);  // Fewer records per poll\n\nAnd ensure the consumer processes records quickly or uses async processing.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Handle RebalanceInProgressException in the consumer loop by catching the exception and retrying after a short delay:\n\ntry {\n    consumer.commitSync();\n} catch (RebalanceInProgressException e) {\n    // Wait for rebalance to complete\n    Thread.sleep(1000);\n    consumer.poll(Duration.ofSeconds(1));  // Trigger rebalance join\n    consumer.commitSync();\n}",
      "success_rate": 0.75,
      "how": "Handle RebalanceInProgressException in the consumer loop by catching the exception and retrying after a short delay:\n\ntry {\n    consumer.commitSync();\n} catch (RebalanceInProgressException e) {\n    // Wait for rebalance to complete\n    Thread.sleep(1000);\n    consumer.poll(Duration.ofSeconds(1));  // Trigger rebalance join\n    consumer.commitSync();\n}",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Increase max.poll.interval.ms to allow more time for processing between polls, reducing the chance of rebalance being triggered:\n\nProperties props = new Properties();\nprops.put(\"max.poll.interval.ms\", 600000);  // 10 minutes\nprops.put(\"max.poll.records\", 500);  // Fewer records per poll\n\nAnd ensure the consumer processes records quickly or uses async processing.",
    "Handle RebalanceInProgressException in the consumer loop by catching the exception and retrying after a short delay:\n\ntry {\n    consumer.commitSync();\n} catch (RebalanceInProgressException e) {\n    // Wait for rebalance to complete\n    Thread.sleep(1000);\n    consumer.poll(Duration.ofSeconds(1));  // Trigger rebalance join\n    consumer.commitSync();\n}"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://kafka.apache.org/documentation/#consumerconfigs_max.poll.interval.ms",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.82,
  "fix_success_rate": 0.75,
  "resolvable": "true",
  "first_seen": "2023-03-10",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}