{
  "id": "cuda/cuda-error-invalid-sync-object",
  "signature": "CUDA error: invalid sync object (cudaErrorInvalidSyncObject)",
  "signature_zh": "CUDA 错误：无效的同步对象 (cudaErrorInvalidSyncObject)",
  "regex": "CUDA error: invalid sync object",
  "domain": "cuda",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A CUDA synchronization object (e.g., cudaExternalSemaphore or cudaEvent) was passed to an API that expects a valid, initialized object, but the object was destroyed, never created, or created on a different device context.",
  "root_cause_type": "generic",
  "root_cause_zh": "向期望有效、已初始化对象的 API 传递了 CUDA 同步对象（例如 cudaExternalSemaphore 或 cudaEvent），但该对象已被销毁、从未创建或在不同的设备上下文中创建。",
  "versions": [
    {
      "version": "CUDA 12.5",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "CUDA 12.7",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "NVIDIA Driver 560.35.03",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "NVIDIA Driver 565.57.01",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "PyTorch 2.6.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Synchronizing the device does not recreate or validate the sync object; it only waits for pending operations to complete.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The error is about an invalid object handle, not resource exhaustion; more streams do not fix a null or cross-context object.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Verify that the sync object is created on the correct device context. For example, in CUDA C++: `cudaSetDevice(deviceId); cudaEvent_t event; cudaEventCreate(&event);` Ensure all subsequent uses of `event` are on the same device.",
      "success_rate": 0.85,
      "how": "Verify that the sync object is created on the correct device context. For example, in CUDA C++: `cudaSetDevice(deviceId); cudaEvent_t event; cudaEventCreate(&event);` Ensure all subsequent uses of `event` are on the same device.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Check if the sync object has been destroyed before reuse. Implement a wrapper that tracks the object's lifetime: `if (event) { cudaEventDestroy(event); event = nullptr; }`",
      "success_rate": 0.8,
      "how": "Check if the sync object has been destroyed before reuse. Implement a wrapper that tracks the object's lifetime: `if (event) { cudaEventDestroy(event); event = nullptr; }`",
      "condition": "",
      "sources": []
    },
    {
      "action": "For external semaphores, ensure the import handle is valid and the driver supports the semaphore type. Use `cudaImportExternalSemaphore` with a properly initialized `cudaExternalSemaphoreHandleDesc`.",
      "success_rate": 0.75,
      "how": "For external semaphores, ensure the import handle is valid and the driver supports the semaphore type. Use `cudaImportExternalSemaphore` with a properly initialized `cudaExternalSemaphoreHandleDesc`.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Verify that the sync object is created on the correct device context. For example, in CUDA C++: `cudaSetDevice(deviceId); cudaEvent_t event; cudaEventCreate(&event);` Ensure all subsequent uses of `event` are on the same device.",
    "Check if the sync object has been destroyed before reuse. Implement a wrapper that tracks the object's lifetime: `if (event) { cudaEventDestroy(event); event = nullptr; }`",
    "For external semaphores, ensure the import handle is valid and the driver supports the semaphore type. Use `cudaImportExternalSemaphore` with a properly initialized `cudaExternalSemaphoreHandleDesc`."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__TYPES.html",
  "official_doc_section": null,
  "error_code": "cudaErrorInvalidSyncObject (806)",
  "verification_tier": "ai_generated",
  "confidence": 0.86,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2025-06-18",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}