{
  "id": "embedded/rtos-hang-on-mutex-lock",
  "signature": "FreeRTOS: Task 'SensorTask' blocked indefinitely on mutex 0x20000400 (owner: 'IdleTask')",
  "signature_zh": "FreeRTOS: 任务'SensorTask'在互斥锁0x20000400上无限阻塞（所有者：'IdleTask'）",
  "regex": "FreeRTOS: Task '.+' blocked indefinitely on mutex 0x[0-9A-Fa-f]+ \\(owner: '.+'\\)",
  "domain": "embedded",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A mutex is held by a lower-priority task that is preempted or sleeping, causing priority inversion without a proper inheritance mechanism.",
  "root_cause_type": "generic",
  "root_cause_zh": "互斥锁被一个被抢占或休眠的低优先级任务持有，导致在没有正确优先级继承机制的情况下发生优先级反转。",
  "versions": [
    {
      "version": "FreeRTOS v10.4.6",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "FreeRTOS v11.0.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "CMSIS-RTOS2 v2.1.3",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Increase the stack size of 'SensorTask' to prevent stack overflow",
      "why_fails": "The issue is not stack size but mutex ownership; increasing stack does not resolve the priority inversion.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "Disable all interrupts to force task execution",
      "why_fails": "Disabling interrupts can cause missed real-time deadlines and does not fix the mutex logic; it may worsen system responsiveness.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Enable priority inheritance by setting configUSE_MUTEXES and configUSE_PRIORITY_INHERITANCE to 1 in FreeRTOSConfig.h, then use xSemaphoreCreateMutex() instead of binary semaphores.",
      "success_rate": 0.8,
      "how": "Enable priority inheritance by setting configUSE_MUTEXES and configUSE_PRIORITY_INHERITANCE to 1 in FreeRTOSConfig.h, then use xSemaphoreCreateMutex() instead of binary semaphores.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Add a timeout to mutex acquisition using xSemaphoreTake(mutex, pdMS_TO_TICKS(100)) and handle failure by releasing and retrying the mutex.",
      "success_rate": 0.7,
      "how": "Add a timeout to mutex acquisition using xSemaphoreTake(mutex, pdMS_TO_TICKS(100)) and handle failure by releasing and retrying the mutex.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Enable priority inheritance by setting configUSE_MUTEXES and configUSE_PRIORITY_INHERITANCE to 1 in FreeRTOSConfig.h, then use xSemaphoreCreateMutex() instead of binary semaphores.",
    "Add a timeout to mutex acquisition using xSemaphoreTake(mutex, pdMS_TO_TICKS(100)) and handle failure by releasing and retrying the mutex."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://www.freertos.org/RTOS-software-timer-software-timer-service.html",
  "official_doc_section": null,
  "error_code": "0xDEADLOCK",
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.75,
  "resolvable": "partial",
  "first_seen": "2024-03-15",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}