{
  "id": "embedded/freertos-timer-queue-overflow",
  "signature": "FreeRTOS: Timer command queue overflow, timer service task cannot process commands",
  "signature_zh": "FreeRTOS：定时器命令队列溢出，定时器服务任务无法处理命令",
  "regex": "FreeRTOS: Timer command queue overflow, timer service task cannot process commands",
  "domain": "embedded",
  "category": "resource_error",
  "subcategory": null,
  "root_cause": "Timer command queue length (configTIMER_QUEUE_LENGTH) is insufficient for the number of concurrent timer API calls from ISRs or tasks, causing queue send failures.",
  "root_cause_type": "generic",
  "root_cause_zh": "定时器命令队列长度(configTIMER_QUEUE_LENGTH)不足以容纳来自ISR或任务的并发定时器API调用，导致队列发送失败。",
  "versions": [
    {
      "version": "FreeRTOS v10.5.1",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "STM32Cube_FW_L4 v1.18.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "IAR EWARM v9.40.1",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Increase timer task priority to highest level",
      "why_fails": "Higher priority does not increase queue length; timer commands still overflow if queue is full.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "Remove all timer API calls from ISRs",
      "why_fails": "ISR calls are often necessary for time-critical operations; removal may break functionality, and overflow can still occur from tasks.",
      "fail_rate": 0.65,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Increase configTIMER_QUEUE_LENGTH in FreeRTOSConfig.h to at least 2x the number of concurrent timer commands (e.g., from 10 to 20). Also set configTIMER_TASK_STACK_DEPTH to 256 to avoid stack overflow.",
      "success_rate": 0.93,
      "how": "Increase configTIMER_QUEUE_LENGTH in FreeRTOSConfig.h to at least 2x the number of concurrent timer commands (e.g., from 10 to 20). Also set configTIMER_TASK_STACK_DEPTH to 256 to avoid stack overflow.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Batch timer commands: instead of calling xTimerChangePeriod() per timer, use a single xTimerStop() and xTimerStart() with new period for grouped timers.",
      "success_rate": 0.85,
      "how": "Batch timer commands: instead of calling xTimerChangePeriod() per timer, use a single xTimerStop() and xTimerStart() with new period for grouped timers.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "在FreeRTOSConfig.h中将configTIMER_QUEUE_LENGTH增加到并发定时器命令数的至少2倍（例如从10增加到20）。同时将configTIMER_TASK_STACK_DEPTH设置为256以避免堆栈溢出。",
    "批量处理定时器命令：不要为每个定时器调用xTimerChangePeriod()，而是对分组定时器使用单个xTimerStop()和xTimerStart()设置新周期。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://www.freertos.org/FreeRTOS-Timers.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.87,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2024-01-10",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}