Error code

DB_DEADLOCK

Database deadlock

  • HTTP status409
  • Classinfrastructure
  • Severitywarning
  • Retryableyes

Database deadlock

MySQL detected a circular lock and rolled back our transaction. Safe to retry idempotently.

Common causes

  • Two writers acquired locks in opposite order.
  • High-contention row (counter, dedup key).
  • Long transactions holding locks too long.

What to do

Caller retries up to 3 times with jitter. If recurring, reorder the lock acquisition or split the hot row.

Deadlock במסד נתונים

MySQL זיהתה lock מעגלי וביטלה את הטרנזקציה שלנו. בטוח לנסות שוב באופן idempotent.

סיבות נפוצות

  • שני כותבים תפסו locks בסדר הפוך.
  • שורת contention גבוהה (counter, dedup).
  • טרנזקציות ארוכות מחזיקות locks זמן רב מדי.

פעולה מומלצת

הקורא ינסה עד 3 פעמים עם jitter. אם חוזר — סדרו מחדש את תפיסת ה־locks או פצלו שורה חמה.