{
  "id": "embedded/freertos-queue-overflow-corruption",
  "signature": "FreeRTOS: Queue send failed due to internal corruption, pxQueue->uxMessagesWaiting = 0xDEAD",
  "signature_zh": "FreeRTOS：队列发送因内部损坏而失败，pxQueue->uxMessagesWaiting = 0xDEAD",
  "regex": "FreeRTOS: Queue send failed due to internal corruption, pxQueue->uxMessagesWaiting = 0x[0-9A-F]+",
  "domain": "embedded",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "Memory corruption in the queue control block, often caused by a buffer overflow or use-after-free in another task.",
  "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": "ARM GCC v12.2.1",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Increasing queue length does not fix memory corruption; the control block is still overwritten by the same bug.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Timing changes may mask the corruption temporarily but do not eliminate the root cause (e.g., buffer overflow).",
      "fail_rate": 0.75,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Add assertions to check queue integrity before each send: `configASSERT(pxQueue->uxMessagesWaiting <= pxQueue->uxLength);` and debug the memory overwrite source",
      "success_rate": 0.7,
      "how": "Add assertions to check queue integrity before each send: `configASSERT(pxQueue->uxMessagesWaiting <= pxQueue->uxLength);` and debug the memory overwrite source",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use a memory protection unit (MPU) to guard queue control block memory, e.g., `mpu_set_region(MPU_REGION_QUEUE, (uint32_t)queue_cb, MPU_RW_PRIVILEGED);`",
      "success_rate": 0.85,
      "how": "Use a memory protection unit (MPU) to guard queue control block memory, e.g., `mpu_set_region(MPU_REGION_QUEUE, (uint32_t)queue_cb, MPU_RW_PRIVILEGED);`",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Add assertions to check queue integrity before each send: `configASSERT(pxQueue->uxMessagesWaiting <= pxQueue->uxLength);` and debug the memory overwrite source",
    "Use a memory protection unit (MPU) to guard queue control block memory, e.g., `mpu_set_region(MPU_REGION_QUEUE, (uint32_t)queue_cb, MPU_RW_PRIVILEGED);`"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://www.freertos.org/implementation/a00011.html",
  "official_doc_section": null,
  "error_code": "FRTOS_ERR_QUEUE_CORRUPT",
  "verification_tier": "ai_generated",
  "confidence": 0.9,
  "fix_success_rate": 0.75,
  "resolvable": "true",
  "first_seen": "2024-06-12",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}