{
  "id": "ros2/rclcpp-parameter-event-callback-deadlock",
  "signature": "rclcpp::exceptions::RCLError: failed to publish parameter event: cannot call publish while in a callback group",
  "signature_zh": "rclcpp::exceptions::RCLError：发布参数事件失败：无法在回调组中调用发布",
  "regex": "failed to publish parameter event: cannot call publish while in a callback group",
  "domain": "ros2",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A parameter event callback tries to publish a message on the same topic that triggered the callback, causing a deadlock in the callback group's executor.",
  "root_cause_type": "generic",
  "root_cause_zh": "参数事件回调尝试在触发回调的同一主题上发布消息，导致回调组执行器死锁。",
  "versions": [
    {
      "version": "ros2-humble",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "ros2-iron",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "ros2-rolling",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "MutuallyExclusive groups still deadlock if the same callback tries to publish to the triggering topic.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The event callback is still in the same callback group; publishing from another node doesn't resolve the deadlock.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Use a separate callback group for the parameter event subscriber: auto param_event_group = create_callback_group(rclcpp::CallbackGroupType::Reentrant); auto sub = create_subscription<rcl_interfaces::msg::ParameterEvent>('/parameter_events', 10, callback, param_event_group);",
      "success_rate": 0.9,
      "how": "Use a separate callback group for the parameter event subscriber: auto param_event_group = create_callback_group(rclcpp::CallbackGroupType::Reentrant); auto sub = create_subscription<rcl_interfaces::msg::ParameterEvent>('/parameter_events', 10, callback, param_event_group);",
      "condition": "",
      "sources": []
    },
    {
      "action": "Publish the parameter event asynchronously using a timer: in the callback, schedule a timer to publish the message after the callback returns.",
      "success_rate": 0.85,
      "how": "Publish the parameter event asynchronously using a timer: in the callback, schedule a timer to publish the message after the callback returns.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "为参数事件订阅者使用单独的回调组：auto param_event_group = create_callback_group(rclcpp::CallbackGroupType::Reentrant); auto sub = create_subscription<rcl_interfaces::msg::ParameterEvent>('/parameter_events', 10, callback, param_event_group);",
    "使用定时器异步发布参数事件：在回调中，安排一个定时器在回调返回后发布消息。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://docs.ros2.org/latest/api/rclcpp/classrclcpp_1_1ParameterEventHandler.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.84,
  "fix_success_rate": 0.85,
  "resolvable": "true",
  "first_seen": "2024-04-12",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}